Rewrite page fieldsets so they reflect article's

This commit is contained in:
Gabriel Augendre 2020-09-12 16:39:07 +02:00
parent 3846456cb2
commit 5fbdf4c3e5
No known key found for this signature in database
GPG key ID: 1E693F4CE4AEE7B4

View file

@ -27,13 +27,13 @@ class ArticleAdmin(admin.ModelAdmin):
(
"Metadata",
{
"fields": (
"fields": [
("title", "slug"),
("author", "comments_allowed"),
("status", "published_at"),
("created_at", "updated_at"),
"views_count",
)
]
},
),
("Content", {"fields": ("content",)}),
@ -95,20 +95,11 @@ class ArticleAdmin(admin.ModelAdmin):
@register(Page)
class PageAdmin(ArticleAdmin):
list_display = ["position"] + ArticleAdmin.list_display
fieldsets = [
(
"Metadata",
{
"fields": (
("title", "slug", "position"),
("author", "status"),
("published_at", "created_at", "updated_at"),
"views_count",
)
},
),
("Content", {"fields": ("content",)}),
]
def get_fieldsets(self, request, obj=None):
article_fieldsets = ArticleAdmin.fieldsets
article_fieldsets[0][1]["fields"][0] = ("title", "slug", "position")
return article_fieldsets
@register(Comment)