Opened 8 years ago

Closed 8 years ago

#26648 closed Cleanup/optimization (fixed)

Add a system check for invalid related_query_names containing underscores

Reported by: Michal Petrucha Owned by: nobody
Component: Core (System checks) Version: dev
Severity: Normal Keywords:
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

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?

Change History (5)

comment:2 by Simon Charette, 8 years ago

Triage Stage: UnreviewedAccepted
Type: UncategorizedCleanup/optimization

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.

comment:3 by Carl Meyer, 8 years ago

Has patch: set

comment:4 by Tim Graham, 8 years ago

Summary: related_query_name is not checked for correctnessAdd a system check for invalid related_query_names containing underscores
Triage Stage: AcceptedReady for checkin

comment:5 by Tim Graham <timograham@…>, 8 years ago

Resolution: fixed
Status: newclosed

In 686a593a:

Fixed #26648 -- Added a system check for invalid related_query_name's containing underscores.

Note: See TracTickets for help on using tickets.
Back to Top