summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMalcolm Tredinnick <malcolm.tredinnick@gmail.com>2008-07-28 01:32:46 +0000
committerMalcolm Tredinnick <malcolm.tredinnick@gmail.com>2008-07-28 01:32:46 +0000
commit19c7db005823efc2da73ca3bcb37ee15451589c8 (patch)
treea2b90e7750141317eb41eabcae5c17035752a39a /tests
parent55ba38f9d26347a68fd25c32ea62d8265f96a176 (diff)
Fixed #7853 -- Fixed another case of deleting inherited models with foreign key
references. Thanks to Russell for the test case that demonstrated the problem. git-svn-id: http://code.djangoproject.com/svn/django/trunk@8128 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'tests')
-rw-r--r--tests/regressiontests/model_inheritance_regress/models.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/regressiontests/model_inheritance_regress/models.py b/tests/regressiontests/model_inheritance_regress/models.py
index fb1fd62798..716c7f5ad8 100644
--- a/tests/regressiontests/model_inheritance_regress/models.py
+++ b/tests/regressiontests/model_inheritance_regress/models.py
@@ -52,7 +52,12 @@ class Parent(models.Model):
class Child(Parent):
name = models.CharField(max_length=10)
+class SelfRefParent(models.Model):
+ parent_data = models.IntegerField()
+ self_data = models.ForeignKey('self', null=True)
+class SelfRefChild(SelfRefParent):
+ child_data = models.IntegerField()
__test__ = {'API_TESTS':"""
# Regression for #7350, #7202
@@ -182,4 +187,11 @@ True
>>> Supplier.objects.filter(restaurant=Restaurant(name='xx', address='yy'))
[]
+# Regression test for #7853
+# If the parent class has a self-referential link, make sure that any updates
+# to that link via the child update the right table.
+
+>>> obj = SelfRefChild.objects.create(child_data=37, parent_data=42)
+>>> obj.delete()
+
"""}