Lookups that span relationships: Typo?
|Reported by:||bkjones@…||Owned by:||nobody|
|Has patch:||no||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
Description (last modified by ubernostrum)
...and specifically this section:
This example retrieves all Entry objects with a Blog whose name is 'Beatles Blog': >>> Entry.objects.filter(blog__name__exact='Beatles Blog') This spanning can be as deep as you'd like. It works backwards, too. To refer to a "reverse" relationship, just use the lowercase name of the model. This example retrieves all Blog objects which have at least one Entry whose headline contains 'Lennon': >>> Blog.objects.filter(entry__headline__contains='Lennon')
First, maybe I'm tired, but I don't see any difference in how the models in those two examples are different with respect to capitalization.
Second, the way it's written: "just use the lowercase name of the model" makes figuring out which example is correct and which might contain a typo ambiguous. That sentence should read something like "just use the lowercase name of the model in the argument to filter()". I do assume that that's what you're talking about, because the objects whose methods are being called are using Python lookups, no?
So, not a huge deal, it's a documentation bug (I think), but it could stump some newbies.