forked from adamlaska/datatracker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathadmin.py
More file actions
23 lines (17 loc) · 729 Bytes
/
admin.py
File metadata and controls
23 lines (17 loc) · 729 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
from django.contrib import admin
from ietf.message.models import Message, SendQueue
class MessageAdmin(admin.ModelAdmin):
list_display = ["subject", "by", "time", "groups"]
search_fields = ["subject", "body"]
raw_id_fields = ["by"]
ordering = ["-time"]
def groups(self, instance):
return ", ".join(g.acronym for g in instance.related_groups.all())
admin.site.register(Message, MessageAdmin)
class SendQueueAdmin(admin.ModelAdmin):
list_display = ["time", "by", "message", "send_at", "sent_at"]
list_filter = ["time", "send_at", "sent_at"]
search_fields = ["message__body"]
raw_id_fields = ["by", "message"]
ordering = ["-time"]
admin.site.register(SendQueue, SendQueueAdmin)