Last active
December 16, 2015 06:29
-
-
Save guillaumepiot/5391705 to your computer and use it in GitHub Desktop.
DJANGO - ADMIN TOOLS - Menu default class
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.core.urlresolvers import reverse | |
from django.utils.translation import ugettext_lazy as _ | |
from admin_tools.menu import items, Menu | |
# to activate your custom menu add the following to your settings.py: | |
# | |
# ADMIN_TOOLS_MENU = 'my_project.menu.CustomMenu' | |
class CustomMenu(Menu): | |
""" | |
Custom Menu for test_proj admin site. | |
""" | |
def __init__(self, **kwargs): | |
Menu.__init__(self, **kwargs) | |
self.children += [ | |
items.MenuItem(_('Dashboard'), reverse('admin:index')), | |
items.AppList( | |
_('Settings'), | |
models=('django.contrib.*',) | |
), | |
items.ModelList( | |
'CMS', | |
['cmsbase.models.*',] | |
), | |
items.ModelList( | |
'Media', | |
['filemanager.models.*',] | |
), | |
] | |
def init_with_context(self, context): | |
""" | |
Use this method if you need to access the request context. | |
""" | |
pass |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment