Re: Reverse query name clashe with a M2M and through

2015-10-23 Thread Gagaro
Indeed, that makes sense! As you said, the issue is that the error message is exactly the same than for a "normal" conflict. Thank you for looking it up. On Friday, 23 October 2015 16:40:46 UTC+2, Simon Charette wrote: > > Hi Gagaro, > > Upon further investigation it looks like the following

Re: Reverse query name clashe with a M2M and through

2015-10-23 Thread Gagaro
On Friday, 23 October 2015 16:35:32 UTC+2, Tom Evans wrote: > > 'Wishlist.user' and 'User.wishlist' are the names of the fields being > discussed. The meaning might be clearer with some added words: > > The reverse query name for the field 'Wishlist.user' clashes with > the field

Re: Reverse query name clashe with a M2M and through

2015-10-23 Thread Simon Charette
Hi Gagaro, Upon further investigation it looks like the following thing is happening, you find have a similar example in the documentation . When you define an explicit through model Django

Re: Reverse query name clashe with a M2M and through

2015-10-23 Thread 'Tom Evans' via Django users
On Fri, Oct 23, 2015 at 3:27 PM, Gagaro wrote: > However, I still have a question. The reverse relation is wishlist_set by > default. Why is Django bothered if the attribute is name wishlist (I would > understand if I named my attribute wishlist_set)? The message doesn't

Re: Reverse query name clashe with a M2M and through

2015-10-23 Thread Gagaro
Hi Simon, thanks for the answer, it cleared some things up. However, I still have a question. The reverse relation is *wishlist_set* by default. Why is Django bothered if the attribute is name *wishlist* (I would understand if I named my attribute *wishlist_set*)? On Friday, 23 October 2015

Re: Reverse query name clashe with a M2M and through

2015-10-23 Thread Simon Charette
Hi Gagaro, Intermediate models are just like other in this regard, they create a related relation hence the reported clash. You should either add related_name='+' on your Wishlist related fields or give them a unique name. Simon Le vendredi 23 octobre 2015 06:01:30 UTC-4, Gagaro a écrit : >

Reverse query name clashe with a M2M and through

2015-10-23 Thread Gagaro
Hello, I have a situation I don't really understand. I have the following models: 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 =