diff options
| author | Simon Charette <charette.s@gmail.com> | 2016-03-28 14:14:24 -0400 |
|---|---|---|
| committer | Simon Charette <charette.s@gmail.com> | 2016-03-28 21:15:16 -0400 |
| commit | 026574e03c6b6fd20a45f97b0470afb70e41fda4 (patch) | |
| tree | e2bc0ff9cdbe64e791679f8b9cc11953ba0fe537 /tests | |
| parent | 97c5539a81c71f314314bc9796e7e87c41ae43b8 (diff) | |
[1.9.x] 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.
Backport of 67cf5efa31acb2916034afb15610b700695dfcb0 from master
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/model_inheritance/tests.py | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/tests/model_inheritance/tests.py b/tests/model_inheritance/tests.py index 1869864a9a..fad47a69ec 100644 --- a/tests/model_inheritance/tests.py +++ b/tests/model_inheritance/tests.py @@ -2,9 +2,10 @@ from __future__ import unicode_literals from operator import attrgetter +from django.apps.registry import Apps 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.utils import six @@ -130,6 +131,26 @@ class ModelInheritanceTests(TestCase): m = MixinModel() self.assertEqual(m.other_attr, 1) + def test_abstract_parent_link(self): + test_apps = Apps(['model_inheritance']) + + class A(models.Model): + class Meta: + apps = test_apps + + class B(A): + a = models.OneToOneField('A', parent_link=True, on_delete=models.CASCADE) + + class Meta: + apps = test_apps + abstract = True + + class C(B): + class Meta: + apps = test_apps + + self.assertIs(C._meta.parents[A], C._meta.get_field('a')) + class ModelInheritanceDataTests(TestCase): @classmethod |
