mirror of
https://github.com/django/django.git
synced 2025-08-03 18:38:50 +00:00
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
This commit is contained in:
parent
55ba38f9d2
commit
19c7db0058
2 changed files with 18 additions and 2 deletions
|
@ -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()
|
||||
|
||||
"""}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue