Files
bugsink/ingest/admin.py
2023-11-03 20:04:54 +01:00

21 lines
513 B
Python

from django.utils.html import escape, mark_safe
from django.contrib import admin
import json
from .models import DecompressedEvent
@admin.register(DecompressedEvent)
class DecompressedEventAdmin(admin.ModelAdmin):
list_display = ["timestamp", "project"]
exclude = ["data"]
readonly_fields = [
'pretty_data',
]
def pretty_data(self, obj):
return mark_safe("<pre>" + escape(json.dumps(json.loads(obj.data), indent=2)) + "</pre>")
pretty_data.short_description = "Data"