31 lines
763 B
Python
31 lines
763 B
Python
import tagulous.admin
|
|
from django.contrib import admin
|
|
from markdownx.admin import MarkdownxModelAdmin
|
|
|
|
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)
|