diff options
| author | Aymeric Augustin <aymeric.augustin@m4x.org> | 2012-12-28 23:16:13 +0100 |
|---|---|---|
| committer | Aymeric Augustin <aymeric.augustin@m4x.org> | 2012-12-28 23:35:08 +0100 |
| commit | 5097d3c5faab2b6582c4cebee2b265fcdbb893eb (patch) | |
| tree | 7ca9e4458d785ab0e30b0afcd07bea5ed39106c5 /tests/regressiontests/admin_inlines/tests.py | |
| parent | be4259004fd21ff5c78f02e9093a0786780e1c21 (diff) | |
[1.5.x] Fix #19524 -- Incorrect caching of parents of unsaved model instances.
Thanks qcwxezdas for the report. Refs #13839.
Backport of e9c24be.
Diffstat (limited to 'tests/regressiontests/admin_inlines/tests.py')
| -rw-r--r-- | tests/regressiontests/admin_inlines/tests.py | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/tests/regressiontests/admin_inlines/tests.py b/tests/regressiontests/admin_inlines/tests.py index 3c868012fa..54283bf509 100644 --- a/tests/regressiontests/admin_inlines/tests.py +++ b/tests/regressiontests/admin_inlines/tests.py @@ -12,7 +12,7 @@ from .admin import InnerInline, TitleInline, site from .models import (Holder, Inner, Holder2, Inner2, Holder3, Inner3, Person, OutfitItem, Fashionista, Teacher, Parent, Child, Author, Book, Profile, ProfileCollection, ParentModelWithCustomPk, ChildModel1, ChildModel2, - Title) + Sighting, Title) @override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',)) @@ -172,6 +172,23 @@ class TestInline(TestCase): self.assertContains(response, child1_shortcut) self.assertContains(response, child2_shortcut) + def test_create_inlines_on_inherited_model(self): + """ + Ensure that an object can be created with inlines when it inherits + another class. Bug #19524. + """ + data = { + 'name': 'Martian', + 'sighting_set-TOTAL_FORMS': 1, + 'sighting_set-INITIAL_FORMS': 0, + 'sighting_set-MAX_NUM_FORMS': 0, + 'sighting_set-0-place': 'Zone 51', + '_save': 'Save', + } + response = self.client.post('/admin/admin_inlines/extraterrestrial/add/', data) + self.assertEqual(response.status_code, 302) + self.assertEqual(Sighting.objects.filter(et__name='Martian').count(), 1) + @override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',)) class TestInlineMedia(TestCase): |
