1
0
mirror of https://github.com/django/django.git synced 2025-10-23 21:59:11 +00:00

Fixed #12561. InlineAdmin now respects can_delete=False. Thanks, nessita.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@12533 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Joseph Kocherhans
2010-02-23 17:14:50 +00:00
parent 10b1871441
commit f2d5582c53
9 changed files with 95 additions and 4 deletions

View File

@@ -5,7 +5,8 @@ from django.conf import settings
from django.contrib.contenttypes.generic import generic_inlineformset_factory
# local test models
from models import Episode, EpisodeExtra, EpisodeMaxNum, EpisodeExclude, Media
from models import Episode, EpisodeExtra, EpisodeMaxNum, EpisodeExclude, \
Media, EpisodePermanent, MediaPermanentInline
class GenericAdminViewTest(TestCase):
fixtures = ['users.xml']
@@ -201,3 +202,11 @@ class GenericInlineAdminWithUniqueTogetherTest(TestCase):
response = self.client.get('/generic_inline_admin/admin/generic_inline_admin/contact/add/')
response = self.client.post('/generic_inline_admin/admin/generic_inline_admin/contact/add/', post_data)
self.failUnlessEqual(response.status_code, 302) # redirect somewhere
class NoInlineDeletionTest(TestCase):
def test_no_deletion(self):
fake_site = object()
inline = MediaPermanentInline(EpisodePermanent, fake_site)
fake_request = object()
formset = inline.get_formset(fake_request)
self.assertFalse(formset.can_delete)