Dashboard Modules¶
Build-In Dashboard Modules¶
LinkList¶
- class jet.dashboard.modules.LinkList(title=None, children=[], **kwargs)¶
List of links widget.
Usage example:
from django.utils.translation import gettext_lazy as _ from jet.dashboard import modules from jet.dashboard.dashboard import Dashboard, AppIndexDashboard class CustomIndexDashboard(Dashboard): columns = 3 def init_with_context(self, context): self.available_children.append(modules.LinkList) self.children.append(modules.LinkList( _('Support'), children=[ { 'title': _('Django documentation'), 'url': 'http://docs.djangoproject.com/', 'external': True, }, { 'title': _('Django "django-users" mailing list'), 'url': 'http://groups.google.com/group/django-users', 'external': True, }, { 'title': _('Django irc channel'), 'url': 'irc://irc.freenode.net/django', 'external': True, }, ], column=0, order=0 ))
- child_form¶
alias of
jet.dashboard.modules.LinkListItemForm
- children = []¶
Links are contained in
children
attribute which you can pass as constructor parameter to make your own preinstalled link lists.children
is an array of dictinaries:[ { 'title': _('Django documentation'), 'url': 'http://docs.djangoproject.com/', 'external': True, }, ... ]
- layout = 'stacked'¶
Specify widget layout. Allowed values
stacked
andinline
.
- load_settings(settings)¶
Should be implemented to restore saved in database settings. Required if you have custom settings.
- settings_dict()¶
Should be implemented to save settings to database. This method should return
dict
which will be serialized usingjson
. Required if you have custom settings.
- settings_form¶
alias of
jet.dashboard.modules.LinkListSettingsForm
- store_children()¶
Specify if children field should be saved to database.
AppList¶
- class jet.dashboard.modules.AppList(title=None, model=None, context=None, **kwargs)¶
Shows applications and containing models links. For each model “created” and “change” links are displayed.
Usage example:
from django.utils.translation import gettext_lazy as _ from jet.dashboard import modules from jet.dashboard.dashboard import Dashboard, AppIndexDashboard class CustomIndexDashboard(Dashboard): columns = 3 def init_with_context(self, context): self.children.append(modules.AppList( _('Applications'), exclude=('auth.*',), column=0, order=0 ))
- exclude = None¶
Specify models which should NOT be displayed.
exclude
is an array of string formatted asapp_label.model
. Also its possible to specify all application models with * sign (e.g.auth.*
).
- init_with_context(context)¶
Allows you to load data and initialize module’s state.
- load_settings(settings)¶
Should be implemented to restore saved in database settings. Required if you have custom settings.
- models = None¶
Specify models which should be displayed.
models
is an array of string formatted asapp_label.model
. Also its possible to specify all application models with * sign (e.g.auth.*
).
- settings_dict()¶
Should be implemented to save settings to database. This method should return
dict
which will be serialized usingjson
. Required if you have custom settings.
ModelList¶
- class jet.dashboard.modules.ModelList(title=None, model=None, context=None, **kwargs)¶
Shows models links. For each model “created” and “change” links are displayed.
Usage example:
from django.utils.translation import gettext_lazy as _ from jet.dashboard import modules from jet.dashboard.dashboard import Dashboard, AppIndexDashboard class CustomIndexDashboard(Dashboard): columns = 3 def init_with_context(self, context): self.children.append(modules.ModelList( _('Models'), exclude=('auth.*',), column=0, order=0 ))
- exclude = None¶
Specify models which should NOT be displayed.
exclude
is an array of string formatted asapp_label.model
. Also its possible to specify all application models with * sign (e.g.auth.*
).
- init_with_context(context)¶
Allows you to load data and initialize module’s state.
- load_settings(settings)¶
Should be implemented to restore saved in database settings. Required if you have custom settings.
- models = None¶
Specify models which should be displayed.
models
is an array of string formatted asapp_label.model
. Also its possible to specify all application models with * sign (e.g.auth.*
).
- settings_dict()¶
Should be implemented to save settings to database. This method should return
dict
which will be serialized usingjson
. Required if you have custom settings.
RecentActions¶
- class jet.dashboard.modules.RecentActions(title=None, limit=10, **kwargs)¶
Display list of most recent admin actions with following information: entity name, type of action, author, date
Usage example:
from django.utils.translation import gettext_lazy as _ from jet.dashboard import modules from jet.dashboard.dashboard import Dashboard, AppIndexDashboard class CustomIndexDashboard(Dashboard): columns = 3 def init_with_context(self, context): self.children.append(modules.RecentActions( _('Recent Actions'), 10, column=0, order=0 ))
- exclude_list = None¶
Specify actions of which models should NOT be displayed.
exclude_list
is an array of string formatted asapp_label.model
. Also its possible to specify all application models with * sign (e.g.auth.*
).
- include_list = None¶
Specify actions of which models should be displayed.
include_list
is an array of string formatted asapp_label.model
. Also its possible to specify all application models with * sign (e.g.auth.*
).
- init_with_context(context)¶
Allows you to load data and initialize module’s state.
- limit = 10¶
Number if entries to be shown (may be changed by each user personally).
- load_settings(settings)¶
Should be implemented to restore saved in database settings. Required if you have custom settings.
- settings_dict()¶
Should be implemented to save settings to database. This method should return
dict
which will be serialized usingjson
. Required if you have custom settings.
- settings_form¶
alias of
jet.dashboard.modules.RecentActionsSettingsForm
Feed¶
- class jet.dashboard.modules.Feed(title=None, feed_url=None, limit=None, **kwargs)¶
Display RSS Feed entries with following information: entry title, date and link to the full version
Usage example:
from django.utils.translation import gettext_lazy as _ from jet.dashboard import modules from jet.dashboard.dashboard import Dashboard, AppIndexDashboard class CustomIndexDashboard(Dashboard): columns = 3 def init_with_context(self, context): self.children.append(modules.Feed( _('Latest Django News'), feed_url='http://www.djangoproject.com/rss/weblog/', limit=5, column=0, order=0 ))
- feed_url = None¶
URL of the RSS feed (may be changed by each user personally).
- init_with_context(context)¶
Allows you to load data and initialize module’s state.
- limit = None¶
Number if entries to be shown (may be changed by each user personally).
- load_settings(settings)¶
Should be implemented to restore saved in database settings. Required if you have custom settings.
- settings_dict()¶
Should be implemented to save settings to database. This method should return
dict
which will be serialized usingjson
. Required if you have custom settings.
- settings_form¶
alias of
jet.dashboard.modules.FeedSettingsForm
Google Analytics Widgets¶
Attention
Google Analytics widgets required extra setup
Extra Installation¶
Install python package:
pip install google-api-python-client==1.4.1
Specify path to your Google Analytics
client_secrets.json
(obtained at Google website):
JET_MODULE_GOOGLE_ANALYTICS_CLIENT_SECRETS_FILE = os.path.join(PROJECT_DIR, 'client_secrets.json')
Add import to the top of your urls.py:
from jet.dashboard.dashboard_modules import google_analytics_views
Usage Example¶
from django.utils.translation import gettext_lazy as _ from jet.dashboard.dashboard import Dashboard, AppIndexDashboard from jet.dashboard.dashboard_modules import google_analytics class CustomIndexDashboard(Dashboard): columns = 3 def init_with_context(self, context): self.available_children.append(google_analytics.GoogleAnalyticsVisitorsTotals) self.available_children.append(google_analytics.GoogleAnalyticsVisitorsChart) self.available_children.append(google_analytics.GoogleAnalyticsPeriodVisitors)
Yandex Metrika Widgets¶
Attention
Yandex Metrika widgets required extra setup
Extra Installation¶
Set your Yandex Metrika CLIENT_ID and CLIENT_SECRET (obtained at Yandex Metrika API website):
JET_MODULE_YANDEX_METRIKA_CLIENT_ID = 'YANDEX_METRIKA_CLIENT_ID'
JET_MODULE_YANDEX_METRIKA_CLIENT_SECRET = 'YANDEX_METRIKA_CLIENT_SECRET'
Add import to the top of your urls.py:
from jet.dashboard.dashboard_modules import yandex_metrika_views
Usage Example¶
from django.utils.translation import gettext_lazy as _ from jet.dashboard.dashboard import Dashboard, AppIndexDashboard from jet.dashboard.dashboard_modules import yandex_metrika class CustomIndexDashboard(Dashboard): columns = 3 def init_with_context(self, context): self.available_children.append(yandex_metrika.YandexMetrikaVisitorsTotals) self.available_children.append(yandex_metrika.YandexMetrikaVisitorsChart) self.available_children.append(yandex_metrika.YandexMetrikaPeriodVisitors)
- class jet.dashboard.dashboard_modules.yandex_metrika.YandexMetrikaVisitorsTotals(title=None, period=None, **kwargs)¶
Yandex Metrika widget that shows total number of visitors, visits and viewers for a particular period of time. Period may be following: Today, Last week, Last month, Last quarter, Last year
- init_with_context(context)¶
Allows you to load data and initialize module’s state.
- period = None¶
Which period should be displayed. Allowed values - integer of days
- class jet.dashboard.dashboard_modules.yandex_metrika.YandexMetrikaVisitorsChart(title=None, period=None, show=None, group=None, **kwargs)¶
Yandex Metrika widget that shows visitors/visits/viewer chart for a particular period of time. Data is grouped by day, week or month Period may be following: Today, Last week, Last month, Last quarter, Last year
- group = None¶
Sets grouping of data. Possible values:
day
,week
,month
- init_with_context(context)¶
Allows you to load data and initialize module’s state.
- load_settings(settings)¶
Should be implemented to restore saved in database settings. Required if you have custom settings.
- period = None¶
Which period should be displayed. Allowed values - integer of days
- settings_dict()¶
Should be implemented to save settings to database. This method should return
dict
which will be serialized usingjson
. Required if you have custom settings.
- settings_form¶
alias of
jet.dashboard.dashboard_modules.yandex_metrika.YandexMetrikaChartSettingsForm
- show = None¶
What data should be shown. Possible values:
visitors
,visits
,page_views
- class jet.dashboard.dashboard_modules.yandex_metrika.YandexMetrikaPeriodVisitors(title=None, period=None, group=None, **kwargs)¶
Yandex Metrika widget that shows visitors, visits and viewers for a particular period of time. Data is grouped by day, week or month Period may be following: Today, Last week, Last month, Last quarter, Last year
- group = None¶
Sets grouping of data. Possible values:
day
,week
,month
- init_with_context(context)¶
Allows you to load data and initialize module’s state.
- load_settings(settings)¶
Should be implemented to restore saved in database settings. Required if you have custom settings.
- period = None¶
Which period should be displayed. Allowed values - integer of days
- settings_dict()¶
Should be implemented to save settings to database. This method should return
dict
which will be serialized usingjson
. Required if you have custom settings.
- settings_form¶
alias of
jet.dashboard.dashboard_modules.yandex_metrika.YandexMetrikaPeriodVisitorsSettingsForm