diff --git a/tests/proxy_model_inheritance/models.py b/tests/proxy_model_inheritance/models.py
index 7a10b77..240fd60 100644
a
|
b
|
class ConcreteModel(models.Model):
|
6 | 6 | pass |
7 | 7 | |
8 | 8 | |
9 | | class ConcreteModelSubclass(ConcreteModel): |
| 9 | class ProxyModel(ConcreteModel): |
| 10 | class Meta: |
| 11 | proxy = True |
| 12 | |
| 13 | |
| 14 | class ConcreteModelSubclass(ProxyModel): |
10 | 15 | pass |
11 | 16 | |
12 | 17 | |
diff --git a/tests/proxy_model_inheritance/tests.py b/tests/proxy_model_inheritance/tests.py
index b0af004..33a90cb 100644
a
|
b
|
import os
|
4 | 4 | |
5 | 5 | from django.core.management import call_command |
6 | 6 | from django.test import TestCase, TransactionTestCase |
7 | | from django.test.utils import extend_sys_path |
| 7 | from django.test.utils import extend_sys_path, CaptureQueriesContext |
8 | 8 | from django.utils._os import upath |
9 | 9 | |
10 | 10 | from .models import ( |
11 | 11 | ConcreteModel, ConcreteModelSubclass, ConcreteModelSubclassProxy, |
| 12 | ProxyModel, |
12 | 13 | ) |
| 14 | from django.db import connection |
13 | 15 | |
14 | 16 | |
15 | 17 | class ProxyModelInheritanceTests(TransactionTestCase): |
… |
… |
class MultiTableInheritanceProxyTest(TestCase):
|
43 | 45 | self.assertEqual(0, ConcreteModelSubclassProxy.objects.count()) |
44 | 46 | self.assertEqual(0, ConcreteModelSubclass.objects.count()) |
45 | 47 | self.assertEqual(0, ConcreteModel.objects.count()) |
| 48 | |
| 49 | def test_deletion_through_intermediate_proxy(self): |
| 50 | child = ConcreteModelSubclass.objects.create() |
| 51 | proxy = ProxyModel.objects.get(pk=child.pk) |
| 52 | with CaptureQueriesContext(connection) as ctx: |
| 53 | proxy.delete() |
| 54 | print(ctx.captured_queries) |
| 55 | self.assertFalse(ConcreteModel.objects.exists()) |
| 56 | print(ConcreteModelSubclass.objects.all()) |
| 57 | self.assertFalse(ConcreteModelSubclass.objects.exists()) |