Update docs and module templates for new recommended import paths
This commit is contained in:
parent
d4ab38e547
commit
bd8ab95785
|
@ -1,6 +1,7 @@
|
|||
from django.utils.translation import ugettext_lazy as _
|
||||
from django.core.urlresolvers import reverse
|
||||
from admin_tools.dashboard.models import *
|
||||
from admin_tools.dashboard import Dashboard, AppIndexDashboard
|
||||
from admin_tools.dashboard import modules
|
||||
|
||||
|
||||
# to activate your index dashboard add the following to your settings.py:
|
||||
|
@ -10,12 +11,12 @@ from admin_tools.dashboard.models import *
|
|||
class CustomIndexDashboard(Dashboard):
|
||||
"""
|
||||
Custom index dashboard for {{ project }}.
|
||||
"""
|
||||
"""
|
||||
def __init__(self, **kwargs):
|
||||
Dashboard.__init__(self, **kwargs)
|
||||
|
||||
# append a link list module for "quick links"
|
||||
self.children.append(LinkListDashboardModule(
|
||||
self.children.append(modules.LinkListDashboardModule(
|
||||
title=_('Quick links'),
|
||||
layout='inline',
|
||||
draggable=False,
|
||||
|
@ -38,32 +39,32 @@ class CustomIndexDashboard(Dashboard):
|
|||
))
|
||||
|
||||
# append an app list module for "Applications"
|
||||
self.children.append(AppListDashboardModule(
|
||||
self.children.append(modules.AppListDashboardModule(
|
||||
title=_('Applications'),
|
||||
exclude_list=('django.contrib',),
|
||||
))
|
||||
|
||||
# append an app list module for "Administration"
|
||||
self.children.append(AppListDashboardModule(
|
||||
self.children.append(modules.AppListDashboardModule(
|
||||
title=_('Administration'),
|
||||
include_list=('django.contrib',),
|
||||
))
|
||||
|
||||
# append a recent actions module
|
||||
self.children.append(RecentActionsDashboardModule(
|
||||
self.children.append(modules.RecentActionsDashboardModule(
|
||||
title=_('Recent Actions'),
|
||||
limit=5
|
||||
))
|
||||
|
||||
# append a feed module
|
||||
self.children.append(FeedDashboardModule(
|
||||
self.children.append(modules.FeedDashboardModule(
|
||||
title=_('Latest Django News'),
|
||||
feed_url='http://www.djangoproject.com/rss/weblog/',
|
||||
limit=5
|
||||
))
|
||||
|
||||
# append another link list module for "support".
|
||||
self.children.append(LinkListDashboardModule(
|
||||
# append another link list module for "support".
|
||||
self.children.append(modules.LinkListDashboardModule(
|
||||
title=_('Support'),
|
||||
children=[
|
||||
{
|
||||
|
@ -98,7 +99,7 @@ class CustomIndexDashboard(Dashboard):
|
|||
class CustomAppIndexDashboard(AppIndexDashboard):
|
||||
"""
|
||||
Custom app index dashboard for {{ project }}.
|
||||
"""
|
||||
"""
|
||||
def __init__(self, *args, **kwargs):
|
||||
AppIndexDashboard.__init__(self, *args, **kwargs)
|
||||
|
||||
|
@ -106,13 +107,13 @@ class CustomAppIndexDashboard(AppIndexDashboard):
|
|||
self.title = ''
|
||||
|
||||
# append a model list module
|
||||
self.children.append(ModelListDashboardModule(
|
||||
self.children.append(modules.ModelListDashboardModule(
|
||||
title=self.app_title,
|
||||
include_list=self.models,
|
||||
))
|
||||
|
||||
# append a recent actions module
|
||||
self.children.append(RecentActionsDashboardModule(
|
||||
self.children.append(modules.RecentActionsDashboardModule(
|
||||
title=_('Recent Actions'),
|
||||
include_list=self.get_app_content_types(),
|
||||
))
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
from django.utils.translation import ugettext_lazy as _
|
||||
from django.core.urlresolvers import reverse
|
||||
from admin_tools.dashboard.models import *
|
||||
from admin_tools.dashboard import AppIndexDashboard
|
||||
from admin_tools.dashboard import modules
|
||||
|
||||
# create your custom modules here if you want, for example:
|
||||
#
|
||||
# class CustomDashboardModule(DashboardModule):
|
||||
# class CustomDashboardModule(modules.DashboardModule):
|
||||
# pass
|
||||
#
|
||||
{% if warning %}
|
||||
|
@ -17,12 +18,12 @@ from admin_tools.dashboard.models import *
|
|||
class {{ app|capfirst }}Dashboard(AppIndexDashboard):
|
||||
"""
|
||||
Document your custom app index dashboard.
|
||||
"""
|
||||
"""
|
||||
def __init__(self, app_title, models, *args, **kwargs):
|
||||
super(CustomAppIndexDashboard, self).__init__(*args, **kwargs)
|
||||
|
||||
# append your modules here, example:
|
||||
# self.append(RecentActionsDashboardModule(
|
||||
# self.append(modules.RecentActionsDashboardModule(
|
||||
# title=_('Recent Actions'),
|
||||
# limit=5,
|
||||
# include_list=models,
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
from admin_tools.menu.menus import *
|
|
@ -1,6 +1,7 @@
|
|||
from django.core.urlresolvers import reverse
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
from admin_tools.menu.models import *
|
||||
from admin_tools.menu import Menu
|
||||
from admin_tools.menu import items
|
||||
|
||||
# to activate your custom menu add the following to your settings.py:
|
||||
#
|
||||
|
@ -12,15 +13,15 @@ class CustomMenu(Menu):
|
|||
"""
|
||||
def __init__(self, **kwargs):
|
||||
Menu.__init__(self, **kwargs)
|
||||
self.children.append(MenuItem(
|
||||
self.children.append(items.MenuItem(
|
||||
title=_('Dashboard'),
|
||||
url=reverse('admin:index')
|
||||
))
|
||||
self.children.append(AppListMenuItem(
|
||||
self.children.append(items.AppListMenuItem(
|
||||
title=_('Applications'),
|
||||
exclude_list=('django.contrib',)
|
||||
))
|
||||
self.children.append(AppListMenuItem(
|
||||
self.children.append(items.AppListMenuItem(
|
||||
title=_('Administration'),
|
||||
include_list=('django.contrib',)
|
||||
))
|
||||
|
|
|
@ -3,55 +3,55 @@
|
|||
The django-admin-tools dashboard and dashboard modules API
|
||||
==========================================================
|
||||
|
||||
This section describe the API of the django-admin-tools dashboard and
|
||||
This section describe the API of the django-admin-tools dashboard and
|
||||
dashboard modules.
|
||||
Make sure you read this before creating your custom dashboard and
|
||||
Make sure you read this before creating your custom dashboard and
|
||||
custom modules.
|
||||
|
||||
The ``Dashboard`` class
|
||||
-----------------------
|
||||
|
||||
.. autoclass:: admin_tools.dashboard.models.Dashboard
|
||||
.. autoclass:: admin_tools.dashboard.Dashboard
|
||||
:members:
|
||||
|
||||
The ``AppIndexDashboard`` class
|
||||
-------------------------------
|
||||
|
||||
.. autoclass:: admin_tools.dashboard.models.AppIndexDashboard
|
||||
.. autoclass:: admin_tools.dashboard.AppIndexDashboard
|
||||
:members:
|
||||
|
||||
The ``DashboardModule`` class
|
||||
-----------------------------
|
||||
|
||||
.. autoclass:: admin_tools.dashboard.models.DashboardModule
|
||||
.. autoclass:: admin_tools.dashboard.modules.DashboardModule
|
||||
:members:
|
||||
|
||||
The ``LinkListDashboardModule`` class
|
||||
-------------------------------------
|
||||
|
||||
.. autoclass:: admin_tools.dashboard.models.LinkListDashboardModule
|
||||
.. autoclass:: admin_tools.dashboard.modules.LinkListDashboardModule
|
||||
:members:
|
||||
|
||||
The ``AppListDashboardModule`` class
|
||||
------------------------------------
|
||||
|
||||
.. autoclass:: admin_tools.dashboard.models.AppListDashboardModule
|
||||
.. autoclass:: admin_tools.dashboard.modules.AppListDashboardModule
|
||||
:members:
|
||||
|
||||
The ``ModelListDashboardModule`` class
|
||||
--------------------------------------
|
||||
|
||||
.. autoclass:: admin_tools.dashboard.models.ModelListDashboardModule
|
||||
.. autoclass:: admin_tools.dashboard.modules.ModelListDashboardModule
|
||||
:members:
|
||||
|
||||
The ``RecentActionsDashboardModule`` class
|
||||
------------------------------------------
|
||||
|
||||
.. autoclass:: admin_tools.dashboard.models.RecentActionsDashboardModule
|
||||
.. autoclass:: admin_tools.dashboard.modules.RecentActionsDashboardModule
|
||||
:members:
|
||||
|
||||
The ``FeedDashboardModule`` class
|
||||
---------------------------------
|
||||
|
||||
.. autoclass:: admin_tools.dashboard.models.FeedDashboardModule
|
||||
.. autoclass:: admin_tools.dashboard.modules.FeedDashboardModule
|
||||
:members:
|
||||
|
|
|
@ -9,23 +9,23 @@ Make sure you read this before creating your custom menu.
|
|||
The ``Menu`` class
|
||||
------------------
|
||||
|
||||
.. autoclass:: admin_tools.menu.models.Menu
|
||||
.. autoclass:: admin_tools.menu.Menu
|
||||
:members:
|
||||
|
||||
The ``MenuItem`` class
|
||||
----------------------
|
||||
|
||||
.. autoclass:: admin_tools.menu.models.MenuItem
|
||||
.. autoclass:: admin_tools.menu.items.MenuItem
|
||||
:members:
|
||||
|
||||
The ``AppListMenuItem`` class
|
||||
-----------------------------
|
||||
|
||||
.. autoclass:: admin_tools.menu.models.AppListMenuItem
|
||||
.. autoclass:: admin_tools.menu.items.AppListMenuItem
|
||||
:members:
|
||||
|
||||
The ``BookmarkMenuItem`` class
|
||||
------------------------------
|
||||
|
||||
.. autoclass:: admin_tools.menu.models.BookmarkMenuItem
|
||||
.. autoclass:: admin_tools.menu.items.BookmarkMenuItem
|
||||
:members:
|
||||
|
|
Loading…
Reference in New Issue