def wpadmin_render_dashboard(context, location='index', dashboard=None): """ Template tag that renders the dashboard, it takes two optional arguments: ``location`` The location of the dashboard, it can be 'index' (for the admin index dashboard) or 'app_index' (for the app index dashboard), the default value is 'index'. ``dashboard`` An instance of ``Dashboard``, if not given, the dashboard is retrieved with the ``get_index_dashboard`` or ``get_app_index_dashboard`` functions, depending on the ``location`` argument. """ if dashboard is None: dashboard = get_index_dashboard(context) dashboard.init_with_context(context) context.update({ 'template': dashboard.template, 'dashboard': dashboard, 'admin_url': reverse('%s:index' % get_admin_site_name(context)), }) return context
def init_with_context(self, context): site_name = get_admin_site_name(context) # append a link list module for "quick links" self.children.append(modules.LinkList( _('Quick links'), collapsible=False, children=[ [_('Return to site'), '/'], [_('Change password'), reverse('%s:password_change' % site_name)], [_('Log out'), reverse('%s:logout' % site_name)], ] )) # append an app list module for "Applications" self.children.append(modules.AppList( _('Applications'), exclude=('django.contrib.*',), )) # append an app list module for "Administration" self.children.append(modules.AppList( _('Administration'), models=('django.contrib.*',), )) # append a recent actions module self.children.append(modules.RecentActions(_('Recent Actions'), 5)) # append a feed module self.children.append(modules.Feed( _('Latest Django News'), feed_url='http://www.djangoproject.com/rss/weblog/', limit=5 )) # append another link list module for "support". 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, }, ] ))
def wpadmin_render_dashboard_module(context, module, index=None, subindex=None): """ Template tag that renders a given dashboard module, it takes a ``DashboardModule`` instance as first parameter and an integer ``index`` as second parameter, that is the index of the module in the dashboard. """ module.init_with_context(context) context.update({ 'template': module.template, 'module': module, 'index': index, 'subindex': subindex, 'admin_url': reverse('%s:index' % get_admin_site_name(context)), }) return context
def init_with_context(self, context): site_name = get_admin_site_name(context) # append a link list module for "quick links" self.children.append( modules.LinkList( _('Quick links'), collapsible=False, children=[ [_('Return to site'), '/'], [ _('Change password'), reverse('%s:password_change' % site_name) ], [_('Log out'), reverse('%s:logout' % site_name)], ])) # append an app list module for "Applications" self.children.append( modules.AppList( _('Applications'), exclude=('django.contrib.*', ), )) # append an app list module for "Administration" self.children.append( modules.AppList( _('Administration'), models=('django.contrib.*', ), )) # append a recent actions module self.children.append(modules.RecentActions(_('Recent Actions'), 5)) # append a feed module self.children.append( modules.Feed(_('Latest Django News'), feed_url='http://www.djangoproject.com/rss/weblog/', limit=5)) # append another link list module for "support". 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, }, ]))
def init_with_context(self, context): site_name = get_admin_site_name(context) # append a group for "Administration" & "Applications" """ self.children.append(modules.Group( _('Group: Administration & Applications'), column=2, collapsible=True, children = [ modules.AppList( _('Administration'), column=1, collapsible=False, models=('django.contrib.*',), ), modules.AppList( _('Applications'), column=1, css_classes=('collapse closed',), exclude=('django.contrib.*',), ) ] )) """ # append an app list module for "Applications" self.children.append( modules.AppList( _("Applications"), collapsible=True, column=1, css_classes=("collapse closed",), exclude=("django.contrib.*",), ) ) # append an app list module for "Administration" self.children.append( modules.ModelList(_("Administration"), column=2, collapsible=False, models=("django.contrib.*",)) ) # append a recent actions module self.children.append(modules.RecentActions(_("Recent Actions"), limit=5, collapsible=False, column=2)) # append another link list module for "support". self.children.append( modules.LinkList( _("Media Management"), column=2, children=[{"title": _("FileBrowser"), "url": "/admin/filebrowser/browse/", "external": False}], ) ) # append another link list module for "support". self.children.append( modules.LinkList( _("Support"), column=2, children=[ {"title": _("Django Documentation"), "url": "http://docs.djangoproject.com/", "external": True}, { "title": _("Grappelli Documentation"), "url": "http://django-wp-admin.readthedocs.org/en/master/", "external": True, }, { "title": _("WP Admin Github"), "url": "https://github.com/barszczmm/django-wpadmin/", "external": True, }, ], ) ) # append a feed module self.children.append( modules.Feed( _("Latest Django News"), column=2, feed_url="http://www.djangoproject.com/rss/weblog/", limit=5 ) )