Django admin cleanup
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user