mirror of
https://github.com/netbox-community/netbox.git
synced 2026-04-28 03:37:34 +02:00
* Fixes #21173: Fix plugin menu registration order timing issue - Converted static MENUS list to dynamic get_menus() function - Ensures plugin menus are built at request time after all plugins complete ready() - Fixes issue where only first few plugin menus appeared in navigation sidebar - Updated navigation template tag to call get_menus() dynamically * Fix ruff linting errors - Add missing blank line before get_menus() function definition - Remove trailing whitespace * Add @cache decorator to get_menus() for performance optimization Per reviewer feedback, the menu list is now cached since it doesn't change without a Django restart. This eliminates redundant list building on each request. --------- Co-authored-by: adionit7 <adionit7@users.noreply.github.com>
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
from django import template
|
||||
|
||||
from netbox.navigation.menu import MENUS
|
||||
from netbox.navigation.menu import get_menus
|
||||
|
||||
__all__ = (
|
||||
'nav',
|
||||
@@ -19,7 +19,7 @@ def nav(context):
|
||||
nav_items = []
|
||||
|
||||
# Construct the navigation menu based upon the current user's permissions
|
||||
for menu in MENUS:
|
||||
for menu in get_menus():
|
||||
groups = []
|
||||
for group in menu.groups:
|
||||
items = []
|
||||
|
||||
Reference in New Issue
Block a user