diff --git a/tests/admin_views/admin.py b/tests/admin_views/admin.py index bc4c7e647f..e8a1cf3bff 100644 --- a/tests/admin_views/admin.py +++ b/tests/admin_views/admin.py @@ -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 diff --git a/tests/admin_views/models.py b/tests/admin_views/models.py index 4d500cd9e6..86ab055f30 100644 --- a/tests/admin_views/models.py +++ b/tests/admin_views/models.py @@ -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)