mirror of
https://github.com/django/django.git
synced 2025-10-28 16:16:12 +00:00
[1.5.x] Fix #19524 -- Incorrect caching of parents of unsaved model instances.
Thanks qcwxezdas for the report. Refs #13839.
Backport of e9c24be.
This commit is contained in:
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user