1
0
mirror of https://github.com/django/django.git synced 2025-10-29 16:46:11 +00:00

Fixed #32433 -- Added error message on QuerySet.delete() following distinct().

This commit is contained in:
Egidijus Macijauskas
2021-02-09 23:43:01 +02:00
committed by Mariusz Felisiak
parent 4e8ecf0cb6
commit 6307c3f1a1
3 changed files with 15 additions and 1 deletions

View File

@@ -724,6 +724,8 @@ class QuerySet:
assert not self.query.is_sliced, \
"Cannot use 'limit' or 'offset' with delete."
if self.query.distinct or self.query.distinct_fields:
raise TypeError('Cannot call delete() after .distinct().')
if self._fields is not None:
raise TypeError("Cannot call delete() after .values() or .values_list()")