Skip to content

Instantly share code, notes, and snippets.

@guillaumepiot
Last active December 16, 2015 06:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save guillaumepiot/5391705 to your computer and use it in GitHub Desktop.
Save guillaumepiot/5391705 to your computer and use it in GitHub Desktop.
DJANGO - ADMIN TOOLS - Menu default class
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