diff options
author | pegler <pegler@gmail.com> | 2013-12-05 11:46:25 -0500 |
---|---|---|
committer | Simon Charette <charette.s@gmail.com> | 2013-12-06 14:12:38 -0500 |
commit | 38e24d680d28b92997def9ab46a961d09bb81dce (patch) | |
tree | 3326fc7c8097283e2d5f9f3efa42604b2cb54b65 /tests/model_inheritance_regress | |
parent | b63acdfe7123c243b28e15f29e5b7a8487d69221 (diff) | |
download | django-38e24d680d28b92997def9ab46a961d09bb81dce.tar.gz |
Fixed #21554 -- Incorrect SQL generated when using multiple inheritance.
Diffstat (limited to 'tests/model_inheritance_regress')
-rw-r--r-- | tests/model_inheritance_regress/models.py | 14 | ||||
-rw-r--r-- | tests/model_inheritance_regress/tests.py | 9 |
2 files changed, 22 insertions, 1 deletions
diff --git a/tests/model_inheritance_regress/models.py b/tests/model_inheritance_regress/models.py index 53752b6948..cb0b2fe72f 100644 --- a/tests/model_inheritance_regress/models.py +++ b/tests/model_inheritance_regress/models.py @@ -233,3 +233,17 @@ class User(models.Model): class Profile(User): profile_id = models.AutoField(primary_key=True) extra = models.CharField(max_length=30, blank=True) + + +# Check concrete + concrete -> concrete -> concrete +class Politician(models.Model): + politician_id = models.AutoField(primary_key=True) + title = models.CharField(max_length=50) + + +class Congressman(Person, Politician): + state = models.CharField(max_length=2) + + +class Senator(Congressman): + pass diff --git a/tests/model_inheritance_regress/tests.py b/tests/model_inheritance_regress/tests.py index 95c693ddd8..3664fc8c04 100644 --- a/tests/model_inheritance_regress/tests.py +++ b/tests/model_inheritance_regress/tests.py @@ -15,7 +15,7 @@ from .models import (Place, Restaurant, ItalianRestaurant, ParkingLot, SelfRefChild, ArticleWithAuthor, M2MChild, QualityControl, DerivedM, Person, BirthdayParty, BachelorParty, MessyBachelorParty, InternalCertificationAudit, BusStation, TrainStation, User, Profile, - ParkingLot4A, ParkingLot4B) + ParkingLot4A, ParkingLot4B, Senator) class ModelInheritanceTest(TestCase): @@ -455,3 +455,10 @@ class ModelInheritanceTest(TestCase): # used in the qs and top contains direct pointer to the bottom model. qs = ItalianRestaurant.objects.values_list('serves_gnocchi').filter(name='foo') self.assertEqual(str(qs.query).count('JOIN'), 1) + + def test_issue_21554(self): + senator = Senator.objects.create( + name='John Doe', title='X', state='Y' + ) + + Senator.objects.get(pk=senator.pk) |