summaryrefslogtreecommitdiff
path: root/tests/delete/tests.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/delete/tests.py')
-rw-r--r--tests/delete/tests.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/delete/tests.py b/tests/delete/tests.py
index 9e383acb4e..663a22791b 100644
--- a/tests/delete/tests.py
+++ b/tests/delete/tests.py
@@ -414,6 +414,17 @@ class DeletionTests(TestCase):
for k, v in existed_objs.items():
self.assertEqual(deleted_objs[k], v)
+ def test_proxied_model_duplicate_queries(self):
+ """
+ #25685 - Deleting instances of a model with existing proxy
+ classes should not issue multiple queries during cascade
+ deletion of referring models.
+ """
+ avatar = Avatar.objects.create()
+ # One query for the Avatar table and a second for the User one.
+ with self.assertNumQueries(2):
+ avatar.delete()
+
class FastDeleteTests(TestCase):