I think there should be a check for `related_query_name` to ensure it does
not end with an underscore, or contain `__` – in either case, it would be
impossible to actually use it in a query.
I'll open a WIP PR in a moment, but when I implemented this check, it
turned out that there's actually a test case already which treats
`related_name='_'` (without an explicit `related_query_name`) as valid. Is
that something we want to support?
--
Ticket URL: <https://code.djangoproject.com/ticket/26648>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* needs_better_patch: => 0
* needs_tests: => 0
* needs_docs: => 0
Comment:
PR as promised: https://github.com/django/django/pull/6640
--
Ticket URL: <https://code.djangoproject.com/ticket/26648#comment:1>
* type: Uncategorized => Cleanup/optimization
* stage: Unreviewed => Accepted
Comment:
> I'll open a WIP PR in a moment, but when I implemented this check, it
turned out that there's actually a test case already which treats
related_name='_' (without an explicit related_query_name) as valid. Is
that something we want to support?
No as it generates an unusable `related_query_name`.
--
Ticket URL: <https://code.djangoproject.com/ticket/26648#comment:2>
* has_patch: 0 => 1
--
Ticket URL: <https://code.djangoproject.com/ticket/26648#comment:3>
* stage: Accepted => Ready for checkin
--
Ticket URL: <https://code.djangoproject.com/ticket/26648#comment:4>
* status: new => closed
* resolution: => fixed
Comment:
In [changeset:"686a593aaadb1c2e2053fee8c401476dcb4617a5" 686a593a]:
{{{
#!CommitTicketReference repository=""
revision="686a593aaadb1c2e2053fee8c401476dcb4617a5"
Fixed #26648 -- Added a system check for invalid related_query_name's
containing underscores.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/26648#comment:5>