mirror of
https://github.com/house-of-vanity/OutFleet.git
synced 2025-08-21 14:37:16 +00:00
Added TG bot
This commit is contained in:
21
vpn/utils.py
Normal file
21
vpn/utils.py
Normal file
@@ -0,0 +1,21 @@
|
||||
"""
|
||||
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>")
|
Reference in New Issue
Block a user