32 lines
760 B
Python
32 lines
760 B
Python
from django.contrib import admin
|
|
|
|
from .models import Message
|
|
|
|
|
|
@admin.register(Message)
|
|
class MessageAdmin(admin.ModelAdmin):
|
|
"""Admin configuration for Message model."""
|
|
|
|
list_display = ("titel", "author", "creation_time")
|
|
list_filter = ("creation_time", "author")
|
|
search_fields = ("titel", "text", "author__username")
|
|
date_hierarchy = "creation_time"
|
|
ordering = ("-creation_time",)
|
|
readonly_fields = ("creation_time",)
|
|
|
|
fieldsets = (
|
|
(
|
|
None,
|
|
{
|
|
"fields": ("titel", "text", "author"),
|
|
},
|
|
),
|
|
(
|
|
"Metadata",
|
|
{
|
|
"fields": ("creation_time",),
|
|
"classes": ("collapse",),
|
|
},
|
|
),
|
|
)
|