[Django] #26648: related_query_name is not checked for correctness

7 views
Skip to first unread message

Django

unread,
May 22, 2016, 5:09:31 PM5/22/16
to django-...@googlegroups.com
#26648: related_query_name is not checked for correctness
--------------------------------------+--------------------
Reporter: koniiiik | Owner: nobody
Type: Uncategorized | Status: new
Component: Core (System checks) | Version: master
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------------+--------------------
This came up on django-users@ the other week:
https://groups.google.com/d/msg/django-users/vR6eR1l3AaY/Zo-H1nFtNwAJ

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.

Django

unread,
May 22, 2016, 5:14:08 PM5/22/16
to django-...@googlegroups.com
#26648: related_query_name is not checked for correctness
-------------------------------------+-------------------------------------

Reporter: koniiiik | Owner: nobody
Type: Uncategorized | Status: new
Component: Core (System | Version: master
checks) |
Severity: Normal | Resolution:
Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by koniiiik):

* 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>

Django

unread,
May 22, 2016, 5:24:20 PM5/22/16
to django-...@googlegroups.com
#26648: related_query_name is not checked for correctness
--------------------------------------+------------------------------------
Reporter: koniiiik | Owner: nobody
Type: Cleanup/optimization | Status: new

Component: Core (System checks) | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by charettes):

* 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>

Django

unread,
Jun 2, 2016, 5:09:07 PM6/2/16
to django-...@googlegroups.com
#26648: related_query_name is not checked for correctness
--------------------------------------+------------------------------------
Reporter: koniiiik | Owner: nobody
Type: Cleanup/optimization | Status: new

Component: Core (System checks) | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by carljm):

* has_patch: 0 => 1


--
Ticket URL: <https://code.djangoproject.com/ticket/26648#comment:3>

Django

unread,
Jun 9, 2016, 11:52:27 AM6/9/16
to django-...@googlegroups.com
#26648: Add a system check for invalid related_query_names containing underscores
-------------------------------------+-------------------------------------
Reporter: koniiiik | Owner: nobody
Type: | Status: new
Cleanup/optimization |

Component: Core (System | Version: master
checks) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Ready for
| checkin

Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by timgraham):

* stage: Accepted => Ready for checkin


--
Ticket URL: <https://code.djangoproject.com/ticket/26648#comment:4>

Django

unread,
Jun 9, 2016, 12:01:13 PM6/9/16
to django-...@googlegroups.com
#26648: Add a system check for invalid related_query_names containing underscores
-------------------------------------+-------------------------------------
Reporter: koniiiik | Owner: nobody
Type: | Status: closed

Cleanup/optimization |
Component: Core (System | Version: master
checks) |
Severity: Normal | Resolution: fixed

Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Tim Graham <timograham@…>):

* 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>

Reply all
Reply to author
Forward
0 new messages