#2038 closed defect (fixed)
QuerySet._combine does not combine where clause
Reported by: | Owned by: | Adrian Holovaty | |
---|---|---|---|
Component: | contrib.admin | Version: | |
Severity: | normal | Keywords: | |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
In db/models/query.py, QuerySet, the _combine method does not actually combine the two query sets. Instead if clones the second one and returns that.
To reproduce:
- Create a custom manager for an object that uses the admin interface, and has a search box.
- Make that custom manager change the 'where' clause of it's query set, for example by using the 'extra' method to limit the query via a join.
- List the objects in the admin interface. You will see the limited set, which is correct.
- Use the search box on the list admin page. The results now returned are not limited by your manager, because the 'where' clause gets lost.
Note:
See TracTickets
for help on using tickets.