Django admin cleanup

This commit is contained in:
IGNY8 VPS (Salman)
2026-01-04 06:04:37 +00:00
parent b2922ebec5
commit 6e30d2d4e8
19 changed files with 827 additions and 424 deletions

View File

@@ -145,7 +145,16 @@ class Igny8ModelAdmin(UnfoldModelAdmin):
for group in sidebar_navigation:
group_is_active = False
for item in group.get('items', []):
item_link = item.get('link', '')
# Unfold stores resolved link in 'link_callback', original lambda in 'link'
item_link = item.get('link_callback') or item.get('link', '')
# Convert to string (handles lazy proxy objects and ensures it's a string)
try:
item_link = str(item_link) if item_link else ''
except:
item_link = ''
# Skip if it's a function representation (e.g., "<function ...>")
if item_link.startswith('<'):
continue
# Check if current path matches this item's link
if item_link and current_path.startswith(item_link):
item['active'] = True