Fixed recursion bug on menu
This commit is contained in:
parent
17974d41fa
commit
34596c3485
|
@ -28,9 +28,9 @@ class OrchestraIndexDashboard(dashboard.FluentIndexDashboard):
|
||||||
'app_name': app_name,
|
'app_name': app_name,
|
||||||
'change_url': url,
|
'change_url': url,
|
||||||
'name': name,
|
'name': name,
|
||||||
'title': options.get('verbose_name')}],
|
'title': options.get('verbose_name_plural')}],
|
||||||
'name': app_name,
|
'name': app_name,
|
||||||
'title': options.get('verbose_name'),
|
'title': options.get('verbose_name_plural'),
|
||||||
'url': add_url,
|
'url': add_url,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
from copy import deepcopy
|
||||||
|
|
||||||
from admin_tools.menu import items, Menu
|
from admin_tools.menu import items, Menu
|
||||||
from django.core.urlresolvers import reverse
|
from django.core.urlresolvers import reverse
|
||||||
from django.utils.text import capfirst
|
from django.utils.text import capfirst
|
||||||
|
@ -27,7 +29,6 @@ def api_link(context):
|
||||||
return reverse('api-root')
|
return reverse('api-root')
|
||||||
|
|
||||||
|
|
||||||
from copy import copy
|
|
||||||
def process_registry(register):
|
def process_registry(register):
|
||||||
def get_item(model, options):
|
def get_item(model, options):
|
||||||
if isinstance(model, str):
|
if isinstance(model, str):
|
||||||
|
@ -47,7 +48,7 @@ def process_registry(register):
|
||||||
parent_item = childrens.get(parent)
|
parent_item = childrens.get(parent)
|
||||||
if parent_item:
|
if parent_item:
|
||||||
if not parent_item.children:
|
if not parent_item.children:
|
||||||
parent_item.children.append(copy(parent_item))
|
parent_item.children.append(deepcopy(parent_item))
|
||||||
else:
|
else:
|
||||||
parent_item = get_item(parent, register[parent])
|
parent_item = get_item(parent, register[parent])
|
||||||
parent_item.children = []
|
parent_item.children = []
|
||||||
|
|
|
@ -13,7 +13,8 @@ class SettingsConfig(AppConfig):
|
||||||
verbose_name = 'Settings'
|
verbose_name = 'Settings'
|
||||||
|
|
||||||
def ready(self):
|
def ready(self):
|
||||||
administration.register_view('settings_setting_change', verbose_name=_("Settings"),
|
administration.register_view('settings_setting_change', verbose_name=_("Setting"),
|
||||||
|
verbose_name_plural=_("Settings"),
|
||||||
icon='Multimedia-volume-control.png')
|
icon='Multimedia-volume-control.png')
|
||||||
|
|
||||||
@register()
|
@register()
|
||||||
|
|
Loading…
Reference in a new issue