Linked news items and categories into admin.
parent
988483a9bc
commit
f3c6b66e7d
|
|
@ -1,3 +1,30 @@
|
|||
import tagulous.admin
|
||||
from django.contrib import admin
|
||||
from markdownx.admin import MarkdownxModelAdmin
|
||||
|
||||
# Register your models here.
|
||||
from .models import Category, NewsItem
|
||||
|
||||
|
||||
@admin.register(Category)
|
||||
class CategoryAdmin(admin.ModelAdmin):
|
||||
list_display = ["title", "slug"]
|
||||
prepopulated_fields = {"slug": ("title",)}
|
||||
|
||||
|
||||
class NewsItemAdmin(MarkdownxModelAdmin):
|
||||
list_display = [
|
||||
"title",
|
||||
"category",
|
||||
"tags",
|
||||
"created_at",
|
||||
"is_published",
|
||||
"is_featured",
|
||||
"owner",
|
||||
]
|
||||
list_filter = ["is_published", "is_featured", "category", "tags", "owner"]
|
||||
ordering = ["is_published", "-created_at"]
|
||||
prepopulated_fields = {"slug": ("title",)}
|
||||
list_display_links = ["title"]
|
||||
|
||||
|
||||
tagulous.admin.register(NewsItem, NewsItemAdmin)
|
||||
|
|
|
|||
Loading…
Reference in New Issue