mirror of
https://github.com/django/django.git
synced 2025-10-24 14:16:09 +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:
@@ -3,6 +3,7 @@ Testing of admin inline formsets.
|
||||
|
||||
"""
|
||||
from django.db import models
|
||||
from django.contrib import admin
|
||||
from django.contrib.contenttypes.models import ContentType
|
||||
from django.contrib.contenttypes import generic
|
||||
|
||||
@@ -29,6 +30,24 @@ class Child(models.Model):
|
||||
def __unicode__(self):
|
||||
return u'I am %s, a child of %s' % (self.name, self.parent)
|
||||
|
||||
|
||||
class Holder(models.Model):
|
||||
dummy = models.IntegerField()
|
||||
|
||||
|
||||
class Inner(models.Model):
|
||||
dummy = models.IntegerField()
|
||||
holder = models.ForeignKey(Holder)
|
||||
|
||||
|
||||
class InnerInline(admin.StackedInline):
|
||||
model = Inner
|
||||
can_delete = False
|
||||
|
||||
|
||||
# Test bug #12561
|
||||
admin.site.register(Holder, inlines=[InnerInline])
|
||||
|
||||
__test__ = {'API_TESTS': """
|
||||
|
||||
# Regression test for #9362
|
||||
@@ -48,4 +67,4 @@ inline form.
|
||||
<Child: I am Joe, a child of John>
|
||||
|
||||
"""
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user