mirror of
https://github.com/django/django.git
synced 2024-12-22 17:16:24 +00:00
Refs #33374 -- Added tests for multi-table fast-deletion with filters that match everything.
This commit is contained in:
parent
7990d254b0
commit
4b702c832c
@ -1,7 +1,7 @@
|
||||
from math import ceil
|
||||
|
||||
from django.db import connection, models
|
||||
from django.db.models import ProtectedError, RestrictedError
|
||||
from django.db.models import ProtectedError, Q, RestrictedError
|
||||
from django.db.models.deletion import Collector
|
||||
from django.db.models.sql.constants import GET_ITERATOR_CHUNK_SIZE
|
||||
from django.test import TestCase, skipIfDBFeature, skipUnlessDBFeature
|
||||
@ -776,3 +776,10 @@ class FastDeleteTests(TestCase):
|
||||
(1, {"delete.Base": 1}),
|
||||
)
|
||||
self.assertIs(Base.objects.exists(), False)
|
||||
|
||||
def test_fast_delete_full_match(self):
|
||||
avatar = Avatar.objects.create(desc="bar")
|
||||
User.objects.create(avatar=avatar)
|
||||
with self.assertNumQueries(1):
|
||||
User.objects.filter(~Q(pk__in=[]) | Q(avatar__desc="foo")).delete()
|
||||
self.assertFalse(User.objects.exists())
|
||||
|
Loading…
Reference in New Issue
Block a user