qs.values().delete() doesn't work consistently
|Reported by:||akaariai||Owned by:||nobody|
|Component:||Database layer (models, ORM)||Version:||1.4|
|Cc:||Triage Stage:||Ready for checkin|
|Has patch:||yes||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
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.