Skip to content

Commit 9672021

Browse files
committed
add basic admin support
1 parent 3814ffd commit 9672021

File tree

1 file changed

+25
-1
lines changed

1 file changed

+25
-1
lines changed

intbot/core/admin.py

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import json
22

3-
from core.models import DiscordMessage, Webhook
3+
from core.models import DiscordMessage, PretalxData, Webhook
44
from django.contrib import admin
55
from django.utils.html import format_html
66

@@ -67,5 +67,29 @@ def content_short(self, obj):
6767
return f"{obj.content[:10]}...{obj.content[-10:]}"
6868

6969

70+
class PretalxDataAdmin(admin.ModelAdmin):
71+
list_display = [
72+
"uuid",
73+
"endpoint",
74+
"created_at",
75+
"modified_at",
76+
]
77+
list_filter = ["created_at"]
78+
readonly_fields = fields = [
79+
"uuid",
80+
"endpoint",
81+
"pretty_content",
82+
"created_at",
83+
"modified_at",
84+
"processed_at",
85+
]
86+
87+
def pretty_content(self, obj):
88+
return format_html("<pre>{}</pre>", json.dumps(obj.content, indent=4))
89+
90+
pretty_content.short_description = "Content"
91+
92+
7093
admin.site.register(Webhook, WebhookAdmin)
7194
admin.site.register(DiscordMessage, DiscordMessageAdmin)
95+
admin.site.register(PretalxData, PretalxDataAdmin)

0 commit comments

Comments
 (0)