Opened 10 years ago
Closed 4 years ago
#24047 closed Cleanup/optimization (wontfix)
Cannot combine values_list querysets that do subqueries
Reported by: | Danielle Madeley | Owned by: | nobody |
---|---|---|---|
Component: | Database layer (models, ORM) | Version: | 1.6 |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Accepted | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
I have a query like:
qs1 = object.comments.values_list('author__email', flat=True) qs2 = object.group.members('email', flat=True) recipients = qs1 & qs2
Where author and members are both User objects. This tells me the fields must match to do a combine. If I override the field by doing something hacky like qs1.fields=email it tells me the base classes must match to do a combine.
Change History (2)
comment:1 by , 10 years ago
Component: | Uncategorized → Database layer (models, ORM) |
---|---|
Triage Stage: | Unreviewed → Accepted |
Type: | Uncategorized → Cleanup/optimization |
comment:2 by , 4 years ago
Resolution: | → wontfix |
---|---|
Status: | new → closed |
I think this should be wontfixed now that the ORM has support for QuerySet.intersection
and friends.
Adding multi-models support to queryset combinations would require massive changes to the internals of QuerySet
and Query
objects.
Note:
See TracTickets
for help on using tickets.
I am not sure if this can be made to work easily, but if not we could document the limitation.