Rewrite page fieldsets so they reflect article's
This commit is contained in:
parent
3846456cb2
commit
5fbdf4c3e5
1 changed files with 7 additions and 16 deletions
|
@ -27,13 +27,13 @@ class ArticleAdmin(admin.ModelAdmin):
|
||||||
(
|
(
|
||||||
"Metadata",
|
"Metadata",
|
||||||
{
|
{
|
||||||
"fields": (
|
"fields": [
|
||||||
("title", "slug"),
|
("title", "slug"),
|
||||||
("author", "comments_allowed"),
|
("author", "comments_allowed"),
|
||||||
("status", "published_at"),
|
("status", "published_at"),
|
||||||
("created_at", "updated_at"),
|
("created_at", "updated_at"),
|
||||||
"views_count",
|
"views_count",
|
||||||
)
|
]
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
("Content", {"fields": ("content",)}),
|
("Content", {"fields": ("content",)}),
|
||||||
|
@ -95,20 +95,11 @@ class ArticleAdmin(admin.ModelAdmin):
|
||||||
@register(Page)
|
@register(Page)
|
||||||
class PageAdmin(ArticleAdmin):
|
class PageAdmin(ArticleAdmin):
|
||||||
list_display = ["position"] + ArticleAdmin.list_display
|
list_display = ["position"] + ArticleAdmin.list_display
|
||||||
fieldsets = [
|
|
||||||
(
|
def get_fieldsets(self, request, obj=None):
|
||||||
"Metadata",
|
article_fieldsets = ArticleAdmin.fieldsets
|
||||||
{
|
article_fieldsets[0][1]["fields"][0] = ("title", "slug", "position")
|
||||||
"fields": (
|
return article_fieldsets
|
||||||
("title", "slug", "position"),
|
|
||||||
("author", "status"),
|
|
||||||
("published_at", "created_at", "updated_at"),
|
|
||||||
"views_count",
|
|
||||||
)
|
|
||||||
},
|
|
||||||
),
|
|
||||||
("Content", {"fields": ("content",)}),
|
|
||||||
]
|
|
||||||
|
|
||||||
|
|
||||||
@register(Comment)
|
@register(Comment)
|
||||||
|
|
Reference in a new issue