mirror of
https://github.com/django/django.git
synced 2025-07-24 05:36:15 +00:00
Fixed #26413 -- Fixed a regression with abstract model inheritance and explicit parent links.
Thanks Trac alias trkjgrdg for the report and Tim for investigation and review.
This commit is contained in:
parent
0c0e8f0a62
commit
67cf5efa31
3 changed files with 30 additions and 3 deletions
|
@ -4,9 +4,9 @@ from operator import attrgetter
|
|||
|
||||
from django.core.exceptions import FieldError, ValidationError
|
||||
from django.core.management import call_command
|
||||
from django.db import connection
|
||||
from django.db import connection, models
|
||||
from django.test import TestCase, TransactionTestCase
|
||||
from django.test.utils import CaptureQueriesContext
|
||||
from django.test.utils import CaptureQueriesContext, isolate_apps
|
||||
from django.utils import six
|
||||
|
||||
from .models import (
|
||||
|
@ -140,6 +140,22 @@ class ModelInheritanceTests(TestCase):
|
|||
m = MixinModel()
|
||||
self.assertEqual(m.other_attr, 1)
|
||||
|
||||
@isolate_apps('model_inheritance')
|
||||
def test_abstract_parent_link(self):
|
||||
class A(models.Model):
|
||||
pass
|
||||
|
||||
class B(A):
|
||||
a = models.OneToOneField('A', parent_link=True, on_delete=models.CASCADE)
|
||||
|
||||
class Meta:
|
||||
abstract = True
|
||||
|
||||
class C(B):
|
||||
pass
|
||||
|
||||
self.assertIs(C._meta.parents[A], C._meta.get_field('a'))
|
||||
|
||||
|
||||
class ModelInheritanceDataTests(TestCase):
|
||||
@classmethod
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue