I want to create an object that contains 2 links to Users. For example:class GameClaim(models.Model):target = models.ForeignKey(User)claimer = models.ForeignKey(User)isAccepted = models.BooleanField()but I am getting the following errors when running the server:Accessor for field 'target' clashes with related field 'User.gameclaim_set'. Add a related_name argument to the definition for 'target'.Accessor for field 'claimer' clashes with related field 'User.gameclaim_set'. Add a related_name argument to the definition for 'claimer'.Can you please explain why I am getting the errors and how to fix them?
These error messages are really good. They already explain how to fix them. And reading up on **[related_name in the documentation]**(docs.djangoproject.com/en/dev/ref/models/fields/#arguments) will explain why they occur.
Good answer, but I don't think you were successful in avoiding rudeness :P The "why" is not obvious unless you are aware of how django works internally.
For someone just learning the framework, this would not be obvious.
Thanks, the error message was not obvious to me either, but your explanation about the reverse relation was very helpful.
Just because the Clash were a good band, doesn't make them a particularly descriptive error message ;)
It should also be mentioned that if you do not need to use the reverse relations for all models. In some cases you might wish the model relation to be one way. In this case you use related_name='+'. This tells Django to create a one way relation and ignore the reverse relation.