File tree 1 file changed +25
-1
lines changed
1 file changed +25
-1
lines changed Original file line number Diff line number Diff line change 1
1
import json
2
2
3
- from core .models import DiscordMessage , Webhook
3
+ from core .models import DiscordMessage , PretalxData , Webhook
4
4
from django .contrib import admin
5
5
from django .utils .html import format_html
6
6
@@ -67,5 +67,29 @@ def content_short(self, obj):
67
67
return f"{ obj .content [:10 ]} ...{ obj .content [- 10 :]} "
68
68
69
69
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
+
70
93
admin .site .register (Webhook , WebhookAdmin )
71
94
admin .site .register (DiscordMessage , DiscordMessageAdmin )
95
+ admin .site .register (PretalxData , PretalxDataAdmin )
You can’t perform that action at this time.
0 commit comments