diff --git a/tests/regressiontests/admin_inlines/admin.py b/tests/regressiontests/admin_inlines/admin.py
index cf51fa4..536c3ec 100644
a
|
b
|
class ChildModel1Inline(admin.TabularInline):
|
124 | 124 | class ChildModel2Inline(admin.StackedInline): |
125 | 125 | model = ChildModel2 |
126 | 126 | |
| 127 | # admin for #19524 |
| 128 | class SightingInline(admin.TabularInline): |
| 129 | model = Sighting |
127 | 130 | |
128 | 131 | site.register(TitleCollection, inlines=[TitleInline]) |
129 | 132 | # Test bug #12561 and #12778 |
… |
… |
site.register(Holder4, Holder4Admin)
|
141 | 144 | site.register(Author, AuthorAdmin) |
142 | 145 | site.register(CapoFamiglia, inlines=[ConsigliereInline, SottoCapoInline]) |
143 | 146 | site.register(ProfileCollection, inlines=[ProfileInline]) |
144 | | site.register(ParentModelWithCustomPk, inlines=[ChildModel1Inline, ChildModel2Inline]) |
145 | | No newline at end of file |
| 147 | site.register(ParentModelWithCustomPk, inlines=[ChildModel1Inline, ChildModel2Inline]) |
| 148 | site.register(ExtraTerrestrial, inlines=[SightingInline]) |
diff --git a/tests/regressiontests/admin_inlines/models.py b/tests/regressiontests/admin_inlines/models.py
index b004d5f..147873a 100644
a
|
b
|
class Inner4Tabular(models.Model):
|
90 | 90 | dummy = models.IntegerField(help_text="Awesome tabular help text is awesome.") |
91 | 91 | holder = models.ForeignKey(Holder4) |
92 | 92 | |
93 | | |
94 | 93 | # Models for #12749 |
95 | 94 | |
96 | 95 | class Person(models.Model): |
… |
… |
class Chapter(models.Model):
|
133 | 132 | |
134 | 133 | |
135 | 134 | # Models for #16838 |
| 135 | |
136 | 136 | class CapoFamiglia(models.Model): |
137 | 137 | name = models.CharField(max_length=100) |
138 | 138 | |
… |
… |
class ChildModel2(models.Model):
|
170 | 170 | def get_absolute_url(self): |
171 | 171 | return '/child_model2/' |
172 | 172 | |
| 173 | # Models for #19524 |
| 174 | |
| 175 | class LifeForm(models.Model): |
| 176 | pass |
| 177 | |
| 178 | class ExtraTerrestrial(LifeForm): |
| 179 | name = models.CharField(max_length=100) |
| 180 | |
| 181 | class Sighting(models.Model): |
| 182 | et = models.ForeignKey(ExtraTerrestrial) |
| 183 | place = models.CharField(max_length=100) |
173 | 184 | |
174 | 185 | # Other models |
175 | 186 | |
diff --git a/tests/regressiontests/admin_inlines/tests.py b/tests/regressiontests/admin_inlines/tests.py
index 3c86801..54283bf 100644
a
|
b
|
from .admin import InnerInline, TitleInline, site
|
12 | 12 | from .models import (Holder, Inner, Holder2, Inner2, Holder3, Inner3, Person, |
13 | 13 | OutfitItem, Fashionista, Teacher, Parent, Child, Author, Book, Profile, |
14 | 14 | ProfileCollection, ParentModelWithCustomPk, ChildModel1, ChildModel2, |
15 | | Title) |
| 15 | Sighting, Title) |
16 | 16 | |
17 | 17 | |
18 | 18 | @override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',)) |
… |
… |
class TestInline(TestCase):
|
172 | 172 | self.assertContains(response, child1_shortcut) |
173 | 173 | self.assertContains(response, child2_shortcut) |
174 | 174 | |
| 175 | def test_create_inlines_on_inherited_model(self): |
| 176 | """ |
| 177 | Ensure that an object can be created with inlines when it inherits |
| 178 | another class. Bug #19524. |
| 179 | """ |
| 180 | data = { |
| 181 | 'name': 'Martian', |
| 182 | 'sighting_set-TOTAL_FORMS': 1, |
| 183 | 'sighting_set-INITIAL_FORMS': 0, |
| 184 | 'sighting_set-MAX_NUM_FORMS': 0, |
| 185 | 'sighting_set-0-place': 'Zone 51', |
| 186 | '_save': 'Save', |
| 187 | } |
| 188 | response = self.client.post('/admin/admin_inlines/extraterrestrial/add/', data) |
| 189 | self.assertEqual(response.status_code, 302) |
| 190 | self.assertEqual(Sighting.objects.filter(et__name='Martian').count(), 1) |
| 191 | |
175 | 192 | |
176 | 193 | @override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',)) |
177 | 194 | class TestInlineMedia(TestCase): |