mirror of
https://github.com/django/django.git
synced 2025-10-24 14:16:09 +00:00
Fixed #20883 -- Made model inheritance find parent links in abstract parents
This commit is contained in:
committed by
Anssi Kääriäinen
parent
dcdc579d16
commit
163a34ce4b
@@ -14,7 +14,8 @@ from .models import (Place, Restaurant, ItalianRestaurant, ParkingLot,
|
||||
ParkingLot2, ParkingLot3, Supplier, Wholesaler, Child, SelfRefParent,
|
||||
SelfRefChild, ArticleWithAuthor, M2MChild, QualityControl, DerivedM,
|
||||
Person, BirthdayParty, BachelorParty, MessyBachelorParty,
|
||||
InternalCertificationAudit, BusStation, TrainStation, User, Profile)
|
||||
InternalCertificationAudit, BusStation, TrainStation, User, Profile,
|
||||
ParkingLot4A, ParkingLot4B)
|
||||
|
||||
|
||||
class ModelInheritanceTest(TestCase):
|
||||
@@ -311,6 +312,19 @@ class ModelInheritanceTest(TestCase):
|
||||
ParkingLot3._meta.get_ancestor_link(Place).name,
|
||||
"parent")
|
||||
|
||||
def test_use_explicit_o2o_to_parent_from_abstract_model(self):
|
||||
self.assertEqual(ParkingLot4A._meta.pk.name, "parent")
|
||||
ParkingLot4A.objects.create(
|
||||
name="Parking4A",
|
||||
address='21 Jump Street',
|
||||
)
|
||||
|
||||
self.assertEqual(ParkingLot4B._meta.pk.name, "parent")
|
||||
ParkingLot4A.objects.create(
|
||||
name="Parking4B",
|
||||
address='21 Jump Street',
|
||||
)
|
||||
|
||||
def test_all_fields_from_abstract_base_class(self):
|
||||
"""
|
||||
Regression tests for #7588
|
||||
|
||||
Reference in New Issue
Block a user