diff --git a/src/servala/frontend/templatetags/pprint_filters.py b/src/servala/frontend/templatetags/pprint_filters.py new file mode 100644 index 0000000..e20772e --- /dev/null +++ b/src/servala/frontend/templatetags/pprint_filters.py @@ -0,0 +1,12 @@ +import json + +from django import template + +register = template.Library() + + +@register.filter +def pprint(value): + if isinstance(value, (dict, list)): + return json.dumps(value, indent=2) + return value