Opened 7 years ago
Closed 7 years ago
#30340 closed Bug (duplicate)
Filtering after `.difference()` does not work
| Reported by: | Herman S | Owned by: | nobody |
|---|---|---|---|
| Component: | Database layer (models, ORM) | Version: | 2.1 |
| 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
Example:
In [*]: User.objects.filter(
...: id__in=[1,2,3,4],
...: ).difference(
...: User.objects.filter(
...: id__in=[1,2],
...: )
...: ).values_list(
...: 'id', flat=True
...: ).filter(
...: id=3,
...: )
Out[*]: <UserQuerySet [3, 4]>
The expected output from the query above is of course only [3,] and not [3,4]
Haven't tested this in 2.2.
Change History (1)
comment:1 by , 7 years ago
| Component: | Uncategorized → Database layer (models, ORM) |
|---|---|
| Resolution: | → duplicate |
| Status: | new → closed |
Note:
See TracTickets
for help on using tickets.
Duplicate of #28519. The limitation is documented: