Raise a descriptive error on update()/delete() operations following QuerySet.union(), intersection(), and difference().
b_filter() seems to merge but does not apply to the actual update
q = M.objects.none()
q = q.union(M.objects.a_filter())
print(q)
q = q.union(M.objects.b_filter())
print(q)
q.update(name='foo')
<QuerySet [<M: M object (675)>]>
<QuerySet [<M: M object (675)>, <M: M object (773)>]>
UPDATE "m" SET "name" = "foo" WHERE `a_filter Conditional statement` ORDER BY U0."id" ASC LIMIT 1); args=(...)
Change History
(7)
Description: |
modified (diff)
|
Description: |
modified (diff)
|
Cc: |
Hasan Ramezani added
|
Summary: |
Can not update unioned queryset after union. → Raise a descriptive error on update()/delete() operations following QuerySet.union(), intersection(), and difference()
|
Triage Stage: |
Unreviewed → Accepted
|
Type: |
Bug → Cleanup/optimization
|
Version: |
2.2 → master
|
Easy pickings: |
set
|
Summary: |
Raise a descriptive error on update()/delete() operations following QuerySet.union(), intersection(), and difference() → Raise a descriptive error on update()/delete() operations following QuerySet.union(), intersection(), and difference().
|
Owner: |
changed from nobody to Hasan Ramezani
|
Status: |
new → assigned
|
Resolution: |
→ fixed
|
Status: |
assigned → closed
|
This operation is unsupported, see documentation:
but I agree that we should raise a descriptive error for
update()
anddelete()
(see related #27995).