#19187: qs.values().delete() doesn't work consistently
-------------------------------------+-------------------------------------
Reporter: akaariai | Owner: nobody
Type: Bug | Status: new
Component: Database | Version: 1.4
layer (models, ORM) | Keywords:
Severity: Normal | Has patch: 0
Triage Stage: Accepted | Needs tests: 0
Needs documentation: 0 | Easy pickings: 0
Patch needs improvement: 0 |
UI/UX: 0 |
-------------------------------------+-------------------------------------
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.
--
Ticket URL: <https://code.djangoproject.com/ticket/19187>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit https://groups.google.com/groups/opt_out.