mpeltriaux
04dc7fcd30
* disables certain admin backends * adds proper ordering to server message admin overview
30 lines
530 B
Python
30 lines
530 B
Python
from django.contrib import admin
|
|
|
|
from news.models import ServerMessage
|
|
|
|
|
|
class ServerMessageAdmin(admin.ModelAdmin):
|
|
readonly_fields = [
|
|
"modified",
|
|
"created",
|
|
]
|
|
list_display = [
|
|
"id",
|
|
"subject",
|
|
"publish_on",
|
|
"is_active",
|
|
]
|
|
search_fields = [
|
|
"subject"
|
|
]
|
|
ordering = [
|
|
"-publish_on"
|
|
]
|
|
|
|
def save_model(self, request, obj, form, change):
|
|
obj.save(user=request.user)
|
|
|
|
|
|
admin.site.register(ServerMessage, ServerMessageAdmin)
|
|
|