Refs #26961 -- Fixed invalid ModelAdmins in tests.

This commit is contained in:
Adam Chainz 2016-08-05 15:20:38 +01:00 committed by Tim Graham
parent 8b734d2f99
commit cd86f03591
2 changed files with 11 additions and 8 deletions

View File

@ -310,7 +310,8 @@ class ParentAdmin(admin.ModelAdmin):
model = Parent
inlines = [ChildInline]
save_as = True
list_display = ('id', 'name',)
list_display_links = ('id',)
list_editable = ('name',)
def save_related(self, request, form, formsets, change):
@ -576,14 +577,14 @@ class StoryAdmin(admin.ModelAdmin):
list_display_links = ('title',) # 'id' not in list_display_links
list_editable = ('content', )
form = StoryForm
ordering = ["-pk"]
ordering = ['-id']
class OtherStoryAdmin(admin.ModelAdmin):
list_display = ('id', 'title', 'content')
list_display_links = ('title', 'id') # 'id' in list_display_links
list_editable = ('content', )
ordering = ["-pk"]
ordering = ['-id']
class ComplexSortedPersonAdmin(admin.ModelAdmin):
@ -710,7 +711,8 @@ class MainPrepopulatedAdmin(admin.ModelAdmin):
class UnorderedObjectAdmin(admin.ModelAdmin):
list_display = ['name']
list_display = ['id', 'name']
list_display_links = ['id']
list_editable = ['name']
list_per_page = 2

View File

@ -913,11 +913,16 @@ class ChildOfReferer(ParentWithFK):
# Models for #23431
class InlineReferer(models.Model):
pass
class ReferencedByInline(models.Model):
name = models.CharField(max_length=20, unique=True)
class InlineReference(models.Model):
referer = models.ForeignKey(InlineReferer, models.CASCADE)
fk = models.ForeignKey(
ReferencedByInline,
models.CASCADE,
@ -926,10 +931,6 @@ class InlineReference(models.Model):
)
class InlineReferer(models.Model):
refs = models.ManyToManyField(InlineReference)
# Models for #23604 and #23915
class Recipe(models.Model):
rname = models.CharField(max_length=20, unique=True)