2021-07-05 14:49:32 +02:00
|
|
|
from django.contrib import admin
|
|
|
|
|
2021-07-06 08:53:08 +02:00
|
|
|
from news.models import ServerMessage
|
2021-07-05 14:49:32 +02:00
|
|
|
|
|
|
|
|
|
|
|
class ServerMessageAdmin(admin.ModelAdmin):
|
2022-02-01 18:41:02 +01:00
|
|
|
readonly_fields = [
|
|
|
|
"modified",
|
|
|
|
"created",
|
|
|
|
]
|
2021-07-05 14:49:32 +02:00
|
|
|
list_display = [
|
|
|
|
"id",
|
|
|
|
"subject",
|
|
|
|
"publish_on",
|
|
|
|
"is_active",
|
|
|
|
]
|
2022-02-01 18:41:02 +01:00
|
|
|
search_fields = [
|
|
|
|
"subject"
|
|
|
|
]
|
2024-04-03 08:29:19 +02:00
|
|
|
ordering = [
|
|
|
|
"-publish_on"
|
|
|
|
]
|
2022-02-01 18:41:02 +01:00
|
|
|
|
|
|
|
def save_model(self, request, obj, form, change):
|
|
|
|
obj.save(user=request.user)
|
|
|
|
|
2021-07-05 14:49:32 +02:00
|
|
|
|
|
|
|
admin.site.register(ServerMessage, ServerMessageAdmin)
|
2022-02-01 18:41:02 +01:00
|
|
|
|