I have the following models in models.py:
class ListinoTraduttore(models.Model):
traduttore = models.ForeignKey(\'Traduttore\', related_name=
This may not answer the original question, but, every so often I run into a similar invalid lookup error because I accidentally used _set in a lookup, e.g. instead of just .
Basically, I tend to confuse the related_query_name with the default_related_name
, which does include _set (also see queries docs and related manager docs).
From the lookups documentation:
It works backwards, too. Whilst it can be customized, by default you refer to a “reverse” relationship in a lookup using the lowercase name of the model.
(my emphasis)
Confusing thing is that the default related_name (i.e. ) is not the same as the default related_query_name (i.e. ), but if you set a custom related_name (or default_related_name, via model Meta options), that will also be used as the default related_query_name (as mentioned in the docs).