It works backwards, too. To refer to a “reverse” relationship, **use the
lowercase name of the model**.
This works only if the name of that relationship hasn't been changed with
**related_name**.
I suggest updating the doc to read:
It works backwards, too. To refer to a “reverse” relationship, use the
lowercase name of the model**, unless you have used related_name to
override the name of the relationship, in which case you should use the
related_name you have set.**
--
Ticket URL: <https://code.djangoproject.com/ticket/31591>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* owner: nobody => Carlton Gibson
* status: new => assigned
* has_patch: 0 => 1
* stage: Unreviewed => Accepted
Comment:
OK, yes. Good spot.
The docs should probably cross-reference
https://docs.djangoproject.com/en/3.0/topics/db/queries/#following-
relationships-backward here.
At the least it's lowercased + `_set`, so correcting the examples to match
the sample models at the top would probably also ease confusion.
[https://github.com/django/django/pull/12935 PR]
--
Ticket URL: <https://code.djangoproject.com/ticket/31591#comment:1>
* status: assigned => closed
* resolution: => fixed
Comment:
In [changeset:"5af17babb0f895cf129fdeee92548d2ac12e78e2" 5af17ba]:
{{{
#!CommitTicketReference repository=""
revision="5af17babb0f895cf129fdeee92548d2ac12e78e2"
Fixed #31591 -- Clarified "reverse" lookup name in making queries docs.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/31591#comment:2>
Comment (by Mariusz Felisiak <felisiak.mariusz@…>):
In [changeset:"844e0591f9591854a0411fb8d90282737f17c40c" 844e0591]:
{{{
#!CommitTicketReference repository=""
revision="844e0591f9591854a0411fb8d90282737f17c40c"
[3.1.x] Fixed #31591 -- Clarified "reverse" lookup name in making queries
docs.
Backport of 5af17babb0f895cf129fdeee92548d2ac12e78e2 from master
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/31591#comment:3>