Opened 6 years ago

Last modified 6 years ago

#24047 new Cleanup/optimization

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 (1)

comment:1 Changed 6 years ago by Tim Graham

Component: UncategorizedDatabase layer (models, ORM)
Triage Stage: UnreviewedAccepted
Type: UncategorizedCleanup/optimization

I am not sure if this can be made to work easily, but if not we could document the limitation.

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