Hello,
class Wishlist(models.Model):
wine = models.ForeignKey('Wine')
user = models.ForeignKey('User')
class Wine(models.Model):
name = models.CharField(max_length=32)
class User(models.Model):
name = models.CharField(max_length=32)
wishlist = models.ManyToManyField(Wine, through=Wishlist)
And the following error:
models_test.Wishlist.user: (fields.E303) Reverse query name for 'Wishlist.user' clashes with field name 'User.wishlist'.
HINT: Rename field 'User.wishlist', or add/change a related_name argument to the definition for field 'Wishlist.user'.
Is that an intended behaviors? In my understanding, there is no related relation created for through models (IE: we can't directly get the Wishlist instance from the User one). Why would the names clash in this case? And why does it clashes on wishlist, the reverse relation shouldn't be wishlist_set and not wishlist?
Thanks.
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/abf0aef4-ffe8-4252-ae5b-7ac9f2150f1d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment