-
Notifications
You must be signed in to change notification settings - Fork 2
/
dashboard.py
46 lines (35 loc) · 1.38 KB
/
dashboard.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
"""
This file was generated with the customdashboard management command, it
contains the two classes for the main dashboard and app index dashboard.
You can customize these classes as you want.
To activate your index dashboard add the following to your settings.py::
ADMIN_TOOLS_INDEX_DASHBOARD = 'mysite.dashboard.CustomIndexDashboard'
And to activate the app index dashboard::
ADMIN_TOOLS_APP_INDEX_DASHBOARD = 'mysite.dashboard.CustomAppIndexDashboard'
"""
from django.utils.translation import ugettext_lazy as _
try:
from django.urls import reverse
except ImportError:
from django.core.urlresolvers import reverse
from admin_tools.dashboard import modules, Dashboard, AppIndexDashboard
from admin_tools.utils import get_admin_site_name
class CustomIndexDashboard(Dashboard):
"""
Custom index dashboard for mysite.
"""
title = ''
def init_with_context(self, context):
self.template = 'base.html'
site_name = get_admin_site_name(context)
class CustomAppIndexDashboard(AppIndexDashboard):
"""
Custom app index dashboard for mysite.
"""
# we disable title because its redundant with the model list module
title = ''
def init_with_context(self, context):
"""
Use this method if you need to access the request context.
"""
return super(CustomAppIndexDashboard, self).init_with_context(context)