mirror of
https://github.com/house-of-vanity/OutFleet.git
synced 2025-08-21 14:37:16 +00:00
21 lines
634 B
Python
21 lines
634 B
Python
"""
|
|
Utility functions for VPN application
|
|
"""
|
|
import json
|
|
from django.utils.safestring import mark_safe
|
|
|
|
|
|
def format_object(data):
|
|
"""
|
|
Format various data types for display in Django admin interface
|
|
"""
|
|
try:
|
|
if isinstance(data, dict):
|
|
formatted_data = json.dumps(data, indent=2)
|
|
return mark_safe(f"<pre>{formatted_data}</pre>")
|
|
elif isinstance(data, str):
|
|
return mark_safe(f"<pre>{data}</pre>")
|
|
else:
|
|
return mark_safe(f"<pre>{str(data)}</pre>")
|
|
except Exception as e:
|
|
return mark_safe(f"<span style='color: red;'>Error: {e}</span>") |