File tree Expand file tree Collapse file tree 1 file changed +25
-1
lines changed Expand file tree Collapse file tree 1 file changed +25
-1
lines changed Original file line number Diff line number Diff line change 11import json
22
3- from core .models import DiscordMessage , Webhook
3+ from core .models import DiscordMessage , PretalxData , Webhook
44from django .contrib import admin
55from 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+
7093admin .site .register (Webhook , WebhookAdmin )
7194admin .site .register (DiscordMessage , DiscordMessageAdmin )
95+ admin .site .register (PretalxData , PretalxDataAdmin )
You can’t perform that action at this time.
0 commit comments