Opened 10 years ago
Closed 10 years ago
#25319 closed Bug (needsinfo)
QuerySet not working with Union + Exclude
| Reported by: | nanchenchen | Owned by: | nobody |
|---|---|---|---|
| Component: | Database layer (models, ORM) | Version: | 1.7 |
| 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
I created a few QuerySets and tried to union them.
However, as long as my querysets contain exclude (i.e., I called queryset.exclude to get the new one), the union operation will be fail.
The error message is "No exception message supplied"
I tracked it and found it failed over here:
/home/vagrant/.virtualenvs/textvisdrg/local/lib/python2.7/site-packages/django/db/models/sql/query.py in change_aliases
def change_aliases(self, change_map):
"""
Changes the aliases in change_map (which maps old-alias -> new-alias),
relabelling any references to them in select columns and the where
clause.
"""
assert set(change_map.keys()).intersection(set(change_map.values())) == set() ...
def relabel_column(col):
if isinstance(col, (list, tuple)):
old_alias = col[0]
return (change_map.get(old_alias, old_alias), col[1])
else:
It's Line 776.
Change History (2)
comment:1 by , 10 years ago
comment:2 by , 10 years ago
| Resolution: | → needsinfo |
|---|---|
| Status: | new → closed |
Note:
See TracTickets
for help on using tickets.
Thanks for the report, but we need example models and queries in order to reproduce the issue.