Opened 12 years ago
Closed 12 years ago
#19187 closed Bug (fixed)
qs.values().delete() doesn't work consistently
Reported by: | Anssi Kääriäinen | Owned by: | nobody |
---|---|---|---|
Component: | Database layer (models, ORM) | Version: | 1.4 |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Ready for checkin | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
If you do SomeModel.objects.values().delete() you will get a stack trace like this one:
File "/home/akaariai/Programming/django/tests/django/db/models/query.py", line 525, in delete collector.collect(del_query) File "/home/akaariai/Programming/django/tests/django/db/models/deletion.py", line 195, in collect reverse_dependency=reverse_dependency) File "/home/akaariai/Programming/django/tests/django/db/models/deletion.py", line 105, in add if obj not in instances: TypeError: unhashable type: 'dict'
However if the "fast-path" deletion route is taken, then the deletion will work.
I think we should make values().delete() and values_list().delete() throw an error explicitly. We might later on want to make values().delete() work, or have special meaning for such queries (see #9519 for example). But for now making sure that this errors consistently seems like a good idea.
Change History (2)
comment:1 by , 12 years ago
Has patch: | set |
---|---|
Triage Stage: | Accepted → Ready for checkin |
comment:2 by , 12 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Note:
See TracTickets
for help on using tickets.
Implemented in https://github.com/akaariai/django/commit/8e99c93bb650a5a87fb811c1b0632469fd3ca82e