mirror of
https://github.com/django/django.git
synced 2025-10-26 07:06:08 +00:00
[1.8.x] Fixed #25685 -- Fixed a duplicate query regression on deletion of proxied models.
Thanks to Trac alias ppetrid for the report and Tim for the review.
This commit is contained in:
@@ -349,6 +349,17 @@ class DeletionTests(TestCase):
|
||||
self.assertFalse(S.objects.exists())
|
||||
self.assertFalse(T.objects.exists())
|
||||
|
||||
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):
|
||||
|
||||
|
||||
Reference in New Issue
Block a user