1. Klemens Mantzos
  2. grappelli-admin-tools

Wiki

Clone wiki

grappelli-admin-tools / Home

grappelli-admin-tools

  • NOTE: Info about the multiple AdminSite()'s support is at the bottom.

SUPPORT

most of the code in grappelli-admin-tools is the same as in django-admin-tools. so the very well written docu http://packages.python.org/django-admin-tools/ works pretty fine for most troubles.

our malinglist: http://groups.google.com/group/django-grappelli

please prefix your mail subject with "admin_tools:".

About

django-admin-tools is a great and very well written django app to customize the django.contrib.admin and get additional handy features. the original code is from David Jean Louis (http://bitbucket.org/izi/django-admin-tools/wiki/Home). Who did a really great job! Thanks.

grappelli-admin-tools is exclusively for the use with grappelli (2.1, and django 1.2.x). Uses the admin_tools.dashboard app only. again in other words: grappelli-admin-tools makes no use of admin_tools.menu and theming. grappelli's admin_tools.dashboard gives you the possibility to sort and group your apps and models as you like.

customizations (compared to django-admin-tools):

  • templates with grid based grappelli dom
  • add column property to DashboardModule()
  • modify dashboard.txt to initially generate grappelli layout

REQUIREMENTS

  • python ;)
  • django 1.2.* or higher (== trunk)
  • grappelli 2.1 or higher (== trunk)

INSTALL

settings.py

INSTALLED_APPS = (
    ....
    'admin_tools.dashboard',
    
    'grappelli',
    
    'django.contrib.admin',
    ...
)
...
ADMIN_TOOLS_INDEX_DASHBOARD = 'xyz.dashboard.CustomIndexDashboard'
ADMIN_TOOLS_APP_INDEX_DASHBOARD = 'xyz.dashboard.CustomAppIndexDashboard'

urls.py

# add this
(r'^admin_tools/', include('admin_tools.urls')),

# make sure you use this syntax! (old syntax doesn't work)
(r'^admin/', include(admin.site.urls)),

Some calls in the shell:

$ python manage.py syncdb
...
$ python manage.py customdashboard

This call creates a dashboard.py in your project path. Customize it as you like. Group/ModelList/AppList should have the property column set to 1. FeedList/LinkList/... should have it set to 2 or 3.

Multiple AdminSite()'s

grappelli-admin-tools can handle multiple AdminSites()'s.

settings.py

...
# admin-tools
ADMIN_TOOLS_INDEX_DASHBOARD = {
    'www.admin.main_site': 'www.dashboard.CustomIndexDashboard',
    'www.admin.admin_site': 'www.dashboard.CustomIndexDashboard2',
}
ADMIN_TOOLS_APP_INDEX_DASHBOARD = {
    'www.admin.main_site': 'www.dashboard.CustomAppIndexDashboard',
    'www.admin.admin_site': 'www.dashboard.CustomAppIndexDashboard2',
}
...

Key's are the PYTHON_PATH to the AdminSite. Value is the PYTHON_PATH to the Dashboard.

One additional restriction: You have to name the AdminSite(). It has to be the same name as the instance is called in the PYTHON_PATH (hope the sample makes this clear):

www/admin.py

...
main_site = admin.AdminSite("main_site")
admin_site = admin.AdminSite("admin_site")
...

Updated