Commits

Anonymous committed f12c1c3 Merge

Updated inline.min.js with update from inline.js

Comments (0)

Files changed (460)

build/lib/admin_tools/__init__.py

-"""
-cotidia-admin-tools is a collection of extensions/tools for the default django 
-administration interface, it includes:
-
- * a full featured and customizable dashboard,
- * a customizable menu bar,
- * tools to make admin theming easier.
-"""
-
-VERSION = (0, 4, 1)
-__version__ = '.'.join(map(str, VERSION))

build/lib/admin_tools/dashboard/__init__.py

-from admin_tools.dashboard.dashboards import *
-from admin_tools.dashboard.registry import *

build/lib/admin_tools/dashboard/dashboards.py

-"""
-Module where admin tools dashboard classes are defined.
-"""
-
-from django.template.defaultfilters import slugify
-from django.utils.importlib import import_module
-from django.utils.translation import ugettext_lazy as _
-from django.core.urlresolvers import reverse
-from django.contrib.contenttypes.models import ContentType
-
-from admin_tools.dashboard import modules
-from admin_tools.utils import get_admin_site_name, uniquify
-
-
-class Dashboard(object):
-    """
-    Base class for dashboards.
-    The Dashboard class is a simple python list that has three additional
-    properties:
-
-    ``title``
-        The dashboard title, by default, it is displayed above the dashboard
-        in a ``h2`` tag. Default value: 'Dashboard'.
-
-    ``template``
-        The template to use to render the dashboard.
-        Default value: 'admin_tools/dashboard/dashboard.html'
-
-    ``columns``
-        An integer that represents the number of columns for the dashboard.
-        Default value: 2.
-
-    If you want to customize the look of your dashboard and it's modules, you
-    can declare css stylesheets and/or javascript files to include when
-    rendering the dashboard (these files should be placed in your
-    media path), for example::
-
-        from admin_tools.dashboard import Dashboard
-
-        class MyDashboard(Dashboard):
-            class Media:
-                css = ('css/mydashboard.css',)
-                js = ('js/mydashboard.js',)
-
-    Here's an example of a custom dashboard::
-
-        from django.core.urlresolvers import reverse
-        from django.utils.translation import ugettext_lazy as _
-        from admin_tools.dashboard import modules, Dashboard
-
-        class MyDashboard(Dashboard):
-
-            # we want a 3 columns layout
-            columns = 3
-
-            def __init__(self, **kwargs):
-
-                # append an app list module for "Applications"
-                self.children.append(modules.AppList(
-                    title=_('Applications'),
-                    exclude=('django.contrib.*',),
-                ))
-
-                # append an app list module for "Administration"
-                self.children.append(modules.AppList(
-                    title=_('Administration'),
-                    models=('django.contrib.*',),
-                ))
-
-                # append a recent actions module
-                self.children.append(modules.RecentActions(
-                    title=_('Recent Actions'),
-                    limit=5
-                ))
-
-    Below is a screenshot of the resulting dashboard:
-
-    .. image:: images/dashboard_example.png
-    """
-
-    title = _('dashboard')
-    template = 'admin_tools/dashboard/dashboard.html'
-    columns = 2
-    children = None
-
-    class Media:
-        css = ()
-        js  = ()
-
-    def __init__(self, **kwargs):
-        for key in kwargs:
-            if hasattr(self.__class__, key):
-                setattr(self, key, kwargs[key])
-        self.children = self.children or []
-
-    def init_with_context(self, context):
-        """
-        Sometimes you may need to access context or request variables to build
-        your dashboard, this is what the ``init_with_context()`` method is for.
-        This method is called just before the display with a
-        ``django.template.RequestContext`` as unique argument, so you can
-        access to all context variables and to the ``django.http.HttpRequest``.
-        """
-        pass
-
-    def get_id(self):
-        """
-        Internal method used to distinguish different dashboards in js code.
-        """
-        return 'dashboard'
-
-    def _prepare_children(self):
-        """ Enumerates children without explicit id """
-        seen = set()
-        for id, module in enumerate(self.children):
-            module.id = uniquify(module.id or str(id+1), seen)
-            module._prepare_children()
-
-
-class AppIndexDashboard(Dashboard):
-    """
-    Class that represents an app index dashboard, app index dashboards are
-    displayed in the applications index page.
-    :class:`~admin_tools.dashboard.AppIndexDashboard` is very similar to the
-    :class:`~admin_tools.dashboard.Dashboard` class except
-    that its constructor receives two extra arguments:
-
-    ``app_title``
-        The title of the application
-
-    ``models``
-        A list of strings representing the available models for the current
-        application, example::
-
-            ['yourproject.app.Model1', 'yourproject.app.Model2']
-
-    It also provides two helper methods:
-
-    ``get_app_model_classes()``
-        Method that returns the list of model classes for the current app.
-
-    ``get_app_content_types()``
-        Method that returns the list of content types for the current app.
-
-    If you want to provide custom app index dashboard, be sure to inherit from
-    this class instead of the :class:`~admin_tools.dashboard.Dashboard` class.
-
-    Here's an example of a custom app index dashboard::
-
-        from django.core.urlresolvers import reverse
-        from django.utils.translation import ugettext_lazy as _
-        from admin_tools.dashboard import modules, AppIndexDashboard
-
-        class MyAppIndexDashboard(AppIndexDashboard):
-
-            # we don't want a title, it's redundant
-            title = ''
-
-            def __init__(self, app_title, models, **kwargs):
-                AppIndexDashboard.__init__(self, app_title, models, **kwargs)
-
-                # append a model list module that lists all models
-                # for the app and a recent actions module for the current app
-                self.children += [
-                    modules.ModelList(self.app_title, self.models),
-                    modules.RecentActions(
-                        include_list=self.models,
-                        limit=5
-                    )
-                ]
-
-    Below is a screenshot of the resulting dashboard:
-
-    .. image:: images/dashboard_app_index_example.png
-    """
-
-    models = None
-    app_title = None
-
-    def __init__(self, app_title, models, **kwargs):
-        kwargs.update({'app_title': app_title, 'models': models})
-        super(AppIndexDashboard, self).__init__(**kwargs)
-
-    def get_app_model_classes(self):
-        """
-        Helper method that returns a list of model classes for the current app.
-        """
-        models = []
-        for m in self.models:
-            mod, cls = m.rsplit('.', 1)
-            mod = import_module(mod)
-            models.append(getattr(mod, cls))
-        return models
-
-    def get_app_content_types(self):
-        """
-        Return a list of all content_types for this app.
-        """
-        return [ContentType.objects.get_for_model(c) for c \
-                in self.get_app_model_classes()]
-
-    def get_id(self):
-        """
-        Internal method used to distinguish different dashboards in js code.
-        """
-        return '%s-dashboard' % slugify(unicode(self.app_title))
-
-
-class DefaultIndexDashboard(Dashboard):
-    """
-    The default dashboard displayed on the admin index page.
-    To change the default dashboard you'll have to type the following from the
-    commandline in your project root directory::
-
-        python manage.py customdashboard
-
-    And then set the ``ADMIN_TOOLS_INDEX_DASHBOARD`` settings variable to
-    point to your custom index dashboard class.
-    """
-    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'),
-            layout='inline',
-            draggable=False,
-            deletable=False,
-            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,
-                },
-            ]
-        ))
-
-
-class DefaultAppIndexDashboard(AppIndexDashboard):
-    """
-    The default dashboard displayed on the applications index page.
-    To change the default dashboard you'll have to type the following from the
-    commandline in your project root directory::
-
-        python manage.py customdashboard
-
-    And then set the ``ADMIN_TOOLS_APP_INDEX_DASHBOARD`` settings variable to
-    point to your custom app index dashboard class.
-    """
-
-    # we disable title because its redundant with the model list module
-    title = ''
-
-    def __init__(self, *args, **kwargs):
-        AppIndexDashboard.__init__(self, *args, **kwargs)
-
-        # append a model list module and a recent actions module
-        self.children += [
-            modules.ModelList( self.app_title,self.models),
-            modules.RecentActions(
-                _('Recent Actions'),
-                include_list=self.get_app_content_types(),
-                limit=5
-            )
-        ]

build/lib/admin_tools/dashboard/forms.py

-from django import forms
-
-from admin_tools.dashboard.models import DashboardPreferences
-
-
-class DashboardPreferencesForm(forms.ModelForm):
-    """
-    This form allows the user to edit dashboard preferences. It doesn't show
-    the user field. It expects the user to be passed in from the view.
-    """
-
-    def __init__(self, *args, **kwargs):
-        self.user = kwargs.pop('user', None)
-        self.dashboard_id = kwargs.pop('dashboard_id', None)
-        super(DashboardPreferencesForm, self).__init__(*args, **kwargs)
-
-    def save(self, *args, **kwargs):
-        preferences = super(DashboardPreferencesForm, self).save(
-            commit=False,
-            *args,
-            **kwargs
-        )
-        preferences.user = self.user
-        preferences.dashboard_id = self.dashboard_id
-        preferences.save()
-        return preferences
-
-    class Meta:
-        fields = ('data',)
-        model = DashboardPreferences

build/lib/admin_tools/dashboard/management/__init__.py

Empty file removed.

build/lib/admin_tools/dashboard/management/commands/__init__.py

Empty file removed.

build/lib/admin_tools/dashboard/management/commands/customdashboard.py

-import os
-from django.core.management.base import BaseCommand, CommandError
-from django.template.loader import render_to_string
-
-DEFAULT_FILE = 'dashboard.py'
-
-class Command(BaseCommand):
-    help = ('Creates a template file containing the base code to get you '
-            'started with your custom dashboard.')
-    args = '[file]'
-    label = 'application name'
-
-    def handle(self, file=None, **options):
-        context = {}
-        context['project'] = os.path.basename(os.getcwd())
-        tpl = ['dashboard/dashboard.txt', 'admin_tools/dashboard/dashboard.txt']
-        dst = file is not None and file or DEFAULT_FILE
-        if os.path.exists(dst):
-            raise CommandError('file "%s" already exists' % dst)
-        context['file'] = os.path.basename(dst).split('.')[0]
-        open(dst, 'w').write(render_to_string(tpl, context))
-        self.stdout.write('"%s" written.' % os.path.join(dst))
-

build/lib/admin_tools/dashboard/models.py

-"""
-This module contains the base classes for the dashboard and dashboard modules.
-"""
-from django.db import models
-
-class DashboardPreferences(models.Model):
-    """
-    This model represents the dashboard preferences for a user.
-    """
-    user = models.ForeignKey('auth.User')
-    data = models.TextField()
-    dashboard_id = models.CharField(max_length=100)
-
-    def __unicode__(self):
-        return "%s dashboard preferences" % self.user.username
-
-    class Meta:
-        db_table = 'admin_tools_dashboard_preferences'
-        ordering = ('user',)
-
-
-# warnings for deprecated imports
-from admin_tools.deprecate_utils import import_path_is_changed
-from admin_tools.dashboard import dashboards
-from admin_tools.dashboard import modules
-
-class Dashboard(
-          import_path_is_changed(
-              'admin_tools.dashboard.models.Dashboard',
-              'admin_tools.dashboard.Dashboard'
-          ),
-          dashboards.Dashboard
-      ): pass
-
-class DefaultIndexDashboard(
-          import_path_is_changed(
-              'admin_tools.dashboard.models.DefaultIndexDashboard',
-              'admin_tools.dashboard.DefaultIndexDashboard',
-          ),
-          dashboards.DefaultIndexDashboard
-      ):pass
-
-class DefaultAppIndexDashboard(
-          import_path_is_changed(
-              'admin_tools.dashboard.models.DefaultAppIndexDashboard',
-              'admin_tools.dashboard.DefaultAppIndexDashboard'
-          ),
-          dashboards.DefaultAppIndexDashboard
-      ):pass
-
-class AppIndexDashboard(
-          import_path_is_changed(
-              'admin_tools.dashboard.models.AppIndexDashboard',
-              'admin_tools.dashboard.AppIndexDashboard'
-          ),
-          dashboards.AppIndexDashboard
-      ):pass
-
-
-class DashboardModule(
-          import_path_is_changed(
-              'admin_tools.dashboard.models.DashboardModule',
-              'admin_tools.dashboard.modules.DashboardModule',
-          ),
-          modules.DashboardModule
-      ):pass
-
-class AppListDashboardModule(
-          import_path_is_changed(
-              'admin_tools.dashboard.models.AppListDashboardModule',
-              'admin_tools.dashboard.modules.AppList',
-          ),
-          modules.AppList
-      ): pass
-
-class ModelListDashboardModule(
-          import_path_is_changed(
-              'admin_tools.dashboard.models.ModelListDashboardModule',
-              'admin_tools.dashboard.modules.ModelList',
-          ),
-          modules.ModelList
-      ): pass
-
-class LinkListDashboardModule(
-          import_path_is_changed(
-              'admin_tools.dashboard.models.LinkListDashboardModule',
-              'admin_tools.dashboard.modules.LinkList',
-          ),
-          modules.LinkList
-      ): pass
-
-class FeedDashboardModule(
-          import_path_is_changed(
-              'admin_tools.dashboard.models.FeedDashboardModule',
-              'admin_tools.dashboard.modules.Feed',
-          ),
-          modules.Feed
-      ): pass

build/lib/admin_tools/dashboard/modules.py

-"""
-Module where admin tools dashboard modules classes are defined.
-"""
-
-from django.utils.text import capfirst
-from django.core.urlresolvers import reverse
-from django.contrib.contenttypes.models import ContentType
-from django.utils.translation import ugettext_lazy as _
-from django.utils.itercompat import is_iterable
-
-from admin_tools.utils import AppListElementMixin, uniquify
-
-
-class DashboardModule(object):
-    """
-    Base class for all dashboard modules.
-    Dashboard modules have the following properties:
-
-    ``enabled``
-        Boolean that determines whether the module should be enabled in
-        the dashboard by default or not. Default value: ``True``.
-
-    ``draggable``
-        Boolean that determines whether the module can be draggable or not.
-        Draggable modules can be re-arranged by users. Default value: ``True``.
-
-    ``collapsible``
-        Boolean that determines whether the module is collapsible, this
-        allows users to show/hide module content. Default: ``True``.
-
-    ``deletable``
-        Boolean that determines whether the module can be removed from the
-        dashboard by users or not. Default: ``True``.
-
-    ``title``
-        String that contains the module title, make sure you use the django
-        gettext functions if your application is multilingual.
-        Default value: ''.
-
-    ``title_url``
-        String that contains the module title URL. If given the module
-        title will be a link to this URL. Default value: ``None``.
-
-    ``css_classes``
-        A list of css classes to be added to the module ``div`` class
-        attribute. Default value: ``None``.
-
-    ``pre_content``
-        Text or HTML content to display above the module content.
-        Default value: ``None``.
-
-    ``content``
-        The module text or HTML content. Default value: ``None``.
-
-    ``post_content``
-        Text or HTML content to display under the module content.
-        Default value: ``None``.
-
-    ``template``
-        The template to use to render the module.
-        Default value: 'admin_tools/dashboard/module.html'.
-    """
-
-    template = 'admin_tools/dashboard/module.html'
-    enabled = True
-    draggable = True
-    collapsible = True
-    deletable = True
-    show_title = True
-    title = ''
-    title_url = None
-    css_classes = None
-    pre_content = None
-    post_content = None
-    children = None
-    id = None
-
-    def __init__(self, title=None, **kwargs):
-        if title is not None:
-            self.title = title
-
-        for key in kwargs:
-            if hasattr(self.__class__, key):
-                setattr(self, key, kwargs[key])
-
-        self.children = self.children or []
-        self.css_classes = self.css_classes or []
-        # boolean flag to ensure that the module is initialized only once
-        self._initialized = False
-
-    def init_with_context(self, context):
-        """
-        Like for the :class:`~admin_tools.dashboard.Dashboard` class, dashboard
-        modules have a ``init_with_context`` method that is called with a
-        ``django.template.RequestContext`` instance as unique argument.
-
-        This gives you enough flexibility to build complex modules, for
-        example, let's build a "history" dashboard module, that will list the
-        last ten visited pages::
-
-            from admin_tools.dashboard import modules
-
-            class HistoryDashboardModule(modules.LinkList):
-                title = 'History'
-
-                def init_with_context(self, context):
-                    request = context['request']
-                    # we use sessions to store the visited pages stack
-                    history = request.session.get('history', [])
-                    for item in history:
-                        self.children.append(item)
-                    # add the current page to the history
-                    history.insert(0, {
-                        'title': context['title'],
-                        'url': request.META['PATH_INFO']
-                    })
-                    if len(history) > 10:
-                        history = history[:10]
-                    request.session['history'] = history
-
-        Here's a screenshot of our history item:
-
-        .. image:: images/history_dashboard_module.png
-        """
-        pass
-
-    def is_empty(self):
-        """
-        Return True if the module has no content and False otherwise.
-
-        >>> mod = DashboardModule()
-        >>> mod.is_empty()
-        True
-        >>> mod.pre_content = 'foo'
-        >>> mod.is_empty()
-        False
-        >>> mod.pre_content = None
-        >>> mod.is_empty()
-        True
-        >>> mod.children.append('foo')
-        >>> mod.is_empty()
-        False
-        >>> mod.children = []
-        >>> mod.is_empty()
-        True
-        """
-        return self.pre_content is None and \
-               self.post_content is None and \
-               len(self.children) == 0
-
-    def render_css_classes(self):
-        """
-        Return a string containing the css classes for the module.
-
-        >>> mod = DashboardModule(enabled=False, draggable=True,
-        ...                       collapsible=True, deletable=True)
-        >>> mod.render_css_classes()
-        'dashboard-module disabled draggable collapsible deletable'
-        >>> mod.css_classes.append('foo')
-        >>> mod.render_css_classes()
-        'dashboard-module disabled draggable collapsible deletable foo'
-        >>> mod.enabled = True
-        >>> mod.render_css_classes()
-        'dashboard-module draggable collapsible deletable foo'
-        """
-        ret = ['dashboard-module']
-        if not self.enabled:
-            ret.append('disabled')
-        if self.draggable:
-            ret.append('draggable')
-        if self.collapsible:
-            ret.append('collapsible')
-        if self.deletable:
-            ret.append('deletable')
-        ret += self.css_classes
-        return ' '.join(ret)
-
-    def _prepare_children(self):
-        pass
-
-
-class Group(DashboardModule):
-    """
-    Represents a group of modules, the group can be displayed in tabs,
-    accordion, or just stacked (default).
-    As well as the :class:`~admin_tools.dashboard.modules.DashboardModule`
-    properties, the :class:`~admin_tools.dashboard.modules.Group`
-    has two extra properties:
-
-    ``display``
-        A string determining how the group should be rendered, this can be one
-        of the following values: 'tabs' (default), 'accordion' or 'stacked'.
-
-    ``force_show_title``
-        Default behaviour for Group module is to force children to always show
-        the title if Group has ``display`` = ``stacked``. If this flag is set
-        to ``False``, children title is shown according to their``show_title``
-        property. Note that in this case is children responsibility to have
-        meaningful content if no title is shown.
-
-    Here's an example of modules group::
-
-        from admin_tools.dashboard import modules, Dashboard
-
-        class MyDashboard(Dashboard):
-            def __init__(self, **kwargs):
-                Dashboard.__init__(self, **kwargs)
-                self.children.append(modules.Group(
-                    title="My group",
-                    display="tabs",
-                    children=[
-                        modules.AppList(
-                            title='Administration',
-                            models=('django.contrib.*',)
-                        ),
-                        modules.AppList(
-                            title='Applications',
-                            exclude=('django.contrib.*',)
-                        )
-                    ]
-                ))
-
-    The screenshot of what this code produces:
-
-    .. image:: images/dashboard_module_group.png
-    """
-
-    force_show_title = True
-    template = 'admin_tools/dashboard/modules/group.html'
-    display = 'tabs'
-
-    def init_with_context(self, context):
-        if self._initialized:
-            return
-        for module in self.children:
-            # to simplify the whole stuff, modules have some limitations,
-            # they cannot be dragged, collapsed or closed
-            module.collapsible = False
-            module.draggable = False
-            module.deletable = False
-            if self.force_show_title:
-                module.show_title = (self.display == 'stacked')
-            module.init_with_context(context)
-        self._initialized = True
-
-    def is_empty(self):
-        """
-        A group of modules is considered empty if it has no children or if
-        all its children are empty.
-
-        >>> from admin_tools.dashboard.modules import DashboardModule, LinkList
-        >>> mod = Group()
-        >>> mod.is_empty()
-        True
-        >>> mod.children.append(DashboardModule())
-        >>> mod.is_empty()
-        True
-        >>> mod.children.append(LinkList('links', children=[
-        ...    {'title': 'example1', 'url': 'http://example.com'},
-        ...    {'title': 'example2', 'url': 'http://example.com'},
-        ... ]))
-        >>> mod.is_empty()
-        False
-        """
-        if super(Group, self).is_empty():
-            return True
-        for child in self.children:
-            if not child.is_empty():
-                return False
-        return True
-
-    def _prepare_children(self):
-        # computes ids for children: generates them if they are not set
-        # and then prepends them with this group's id
-        seen = set()
-        for id, module in enumerate(self.children):
-            proposed_id = "%s_%s" % (self.id, module.id or id+1)
-            module.id = uniquify(proposed_id, seen)
-            module._prepare_children()
-
-
-class LinkList(DashboardModule):
-    """
-    A module that displays a list of links.
-    As well as the :class:`~admin_tools.dashboard.modules.DashboardModule`
-    properties, the :class:`~admin_tools.dashboard.modules.LinkList` takes
-    an extra keyword argument:
-
-    ``layout``
-        The layout of the list, possible values are ``stacked`` and ``inline``.
-        The default value is ``stacked``.
-
-    Link list modules children are simple python dictionaries that can have the
-    following keys:
-
-    ``title``
-        The link title.
-
-    ``url``
-        The link URL.
-
-    ``external``
-        Boolean that indicates whether the link is an external one or not.
-
-    ``description``
-        A string describing the link, it will be the ``title`` attribute of
-        the html ``a`` tag.
-
-    Children can also be iterables (lists or tuples) of length 2, 3 or 4.
-
-    Here's a small example of building a link list module::
-
-        from admin_tools.dashboard import modules, Dashboard
-
-        class MyDashboard(Dashboard):
-            def __init__(self, **kwargs):
-                Dashboard.__init__(self, **kwargs)
-
-                self.children.append(modules.LinkList(
-                    layout='inline',
-                    children=(
-                        {
-                            'title': 'Python website',
-                            'url': 'http://www.python.org',
-                            'class': '',
-                            'description': 'Python programming language rocks !',
-                        },
-                        ['Django website', 'http://www.djangoproject.com', True],
-                        ['Some internal link', '/some/internal/link/'],
-                    )
-                ))
-
-    The screenshot of what this code produces:
-
-    .. image:: images/linklist_dashboard_module.png
-    """
-
-    title = _('Links')
-    template = 'admin_tools/dashboard/modules/link_list.html'
-    layout = 'stacked'
-
-    def init_with_context(self, context):
-        if self._initialized:
-            return
-        new_children = []
-        for link in self.children:
-            if isinstance(link, (tuple, list,)):
-                link_dict = {'title': link[0], 'url': link[1]}
-                if len(link) >= 3:
-                    link_dict['class'] = link[2]
-                if len(link) >= 4:
-                    link_dict['description'] = link[3]
-
-                new_children.append(link_dict)
-            else:
-                new_children.append(link)
-        self.children = new_children
-        self._initialized = True
-
-    def __unicode__(self):
-        return u'%s' % self.name
-
-    def name(self):
-        return 'linklist'
-
-
-class AppList(DashboardModule, AppListElementMixin):
-    """
-    Module that lists installed apps and their models.
-    As well as the :class:`~admin_tools.dashboard.modules.DashboardModule`
-    properties, the :class:`~admin_tools.dashboard.modules.AppList`
-    has two extra properties:
-
-    ``models``
-        A list of models to include, only models whose name (e.g.
-        "blog.comments.Comment") match one of the strings (e.g. "blog.*")
-        in the models list will appear in the dashboard module.
-
-    ``exclude``
-        A list of models to exclude, if a model name (e.g.
-        "blog.comments.Comment") match an element of this list (e.g.
-        "blog.comments.*") it won't appear in the dashboard module.
-
-    If no models/exclude list is provided, **all apps** are shown.
-
-    Here's a small example of building an app list module::
-
-        from admin_tools.dashboard import modules, Dashboard
-
-        class MyDashboard(Dashboard):
-            def __init__(self, **kwargs):
-                Dashboard.__init__(self, **kwargs)
-
-                # will only list the django.contrib apps
-                self.children.append(modules.AppList(
-                    title='Administration',
-                    models=('django.contrib.*',)
-                ))
-                # will list all apps except the django.contrib ones
-                self.children.append(modules.AppList(
-                    title='Applications',
-                    exclude=('django.contrib.*',)
-                ))
-
-    The screenshot of what this code produces:
-
-    .. image:: images/applist_dashboard_module.png
-
-    .. note::
-
-        Note that this module takes into account user permissions, for
-        example, if a user has no rights to change or add a ``Group``, then
-        the django.contrib.auth.Group model line will not be displayed.
-    """
-
-    title = _('Applications')
-    template = 'admin_tools/dashboard/modules/app_list.html'
-    models = None
-    exclude = None
-    include_list = None
-    exclude_list = None
-
-    def __init__(self, title=None, **kwargs):
-        self.models = list(kwargs.pop('models', []))
-        self.exclude = list(kwargs.pop('exclude', []))
-        self.include_list = kwargs.pop('include_list', []) # deprecated
-        self.exclude_list = kwargs.pop('exclude_list', []) # deprecated
-        super(AppList, self).__init__(title, **kwargs)
-
-    def init_with_context(self, context):
-        if self._initialized:
-            return
-        items = self._visible_models(context['request'])
-        apps = {}
-        for model, perms in items:
-            app_label = model._meta.app_label
-            if app_label not in apps:
-                apps[app_label] = {
-                    'title': capfirst(app_label.title()),
-                    'url': self._get_admin_app_list_url(model, context),
-                    'models': []
-                }
-            model_dict = {}
-            model_dict['title'] = capfirst(model._meta.verbose_name_plural)
-            if perms['change']:
-                model_dict['change_url'] = self._get_admin_change_url(model, context)
-            if perms['add']:
-                model_dict['add_url'] = self._get_admin_add_url(model, context)
-            apps[app_label]['models'].append(model_dict)
-
-        apps_sorted = apps.keys()
-        apps_sorted.sort()
-        for app in apps_sorted:
-            # sort model list alphabetically
-            apps[app]['models'].sort(lambda x, y: cmp(x['title'], y['title']))
-            self.children.append(apps[app])
-        self._initialized = True
-
-    def __unicode__(self):
-        return u'%s' % self.name
-
-    def name(self):
-        return 'applist'
-
-class ModelList(DashboardModule, AppListElementMixin):
-    """
-    Module that lists a set of models.
-    As well as the :class:`~admin_tools.dashboard.modules.DashboardModule`
-    properties, the :class:`~admin_tools.dashboard.modules.ModelList` takes
-    two extra arguments:
-
-    ``models``
-        A list of models to include, only models whose name (e.g.
-        "blog.comments.Comment") match one of the strings (e.g. "blog.*")
-        in the models list will appear in the dashboard module.
-
-    ``exclude``
-        A list of models to exclude, if a model name (e.g.
-        "blog.comments.Comment") match an element of this list (e.g.
-        "blog.comments.*") it won't appear in the dashboard module.
-
-    Here's a small example of building a model list module::
-
-        from admin_tools.dashboard import modules, Dashboard
-
-        class MyDashboard(Dashboard):
-            def __init__(self, **kwargs):
-                Dashboard.__init__(self, **kwargs)
-
-                # will only list the django.contrib.auth models
-                self.children += [
-                    modules.ModelList('Authentication', ['django.contrib.auth.*',])
-                ]
-
-    The screenshot of what this code produces:
-
-    .. image:: images/modellist_dashboard_module.png
-
-    .. note::
-
-        Note that this module takes into account user permissions, for
-        example, if a user has no rights to change or add a ``Group``, then
-        the django.contrib.auth.Group model line will not be displayed.
-    """
-
-    template = 'admin_tools/dashboard/modules/model_list.html'
-    models = None
-    exclude = None
-    include_list = None
-    exclude_list = None
-
-    def __init__(self, title=None, models=None, exclude=None, **kwargs):
-        self.models = list(models or [])
-        self.exclude = list(exclude or [])
-        self.include_list = kwargs.pop('include_list', []) # deprecated
-        self.exclude_list = kwargs.pop('exclude_list', []) # deprecated
-        super(ModelList, self).__init__(title, **kwargs)
-
-    def init_with_context(self, context):
-        if self._initialized:
-            return
-        items = self._visible_models(context['request'])
-        if not items:
-            return
-        for model, perms in items:
-            model_dict = {}
-            model_dict['title'] = capfirst(model._meta.verbose_name_plural)
-            if perms['change']:
-                model_dict['change_url'] = self._get_admin_change_url(model, context)
-            if perms['add']:
-                model_dict['add_url'] = self._get_admin_add_url(model, context)
-            self.children.append(model_dict)
-        self._initialized = True
-
-    def __unicode__(self):
-        return u'%s' % self.name
-
-    def name(self):
-        return 'modellist'
-
-
-class RecentActions(DashboardModule):
-    """
-    Module that lists the recent actions for the current user.
-    As well as the :class:`~admin_tools.dashboard.modules.DashboardModule`
-    properties, the :class:`~admin_tools.dashboard.modules.RecentActions`
-    takes three extra keyword arguments:
-
-    ``include_list``
-        A list of contenttypes (e.g. "auth.group" or "sites.site") to include,
-        only recent actions that match the given contenttypes will be
-        displayed.
-
-    ``exclude_list``
-        A list of contenttypes (e.g. "auth.group" or "sites.site") to exclude,
-        recent actions that match the given contenttypes will not be
-        displayed.
-
-    ``limit``
-        The maximum number of children to display. Default value: 10.
-
-    Here's a small example of building a recent actions module::
-
-        from admin_tools.dashboard import modules, Dashboard
-
-        class MyDashboard(Dashboard):
-            def __init__(self, **kwargs):
-                Dashboard.__init__(self, **kwargs)
-
-                # will only list the django.contrib apps
-                self.children.append(modules.RecentActions(
-                    title='Django CMS recent actions',
-                    include_list=('cms.page', 'cms.cmsplugin',)
-                ))
-
-    The screenshot of what this code produces:
-
-    .. image:: images/recentactions_dashboard_module.png
-    """
-    title = _('Recent Actions')
-    template = 'admin_tools/dashboard/modules/recent_actions.html'
-    limit = 10
-    include_list = None
-    exclude_list = None
-
-    def __init__(self, title=None, limit=10, include_list=None,
-                 exclude_list=None, **kwargs):
-        self.include_list = include_list or []
-        self.exclude_list = exclude_list or []
-        kwargs.update({'limit': limit})
-        super(RecentActions, self).__init__(title, **kwargs)
-
-    def init_with_context(self, context):
-        if self._initialized:
-            return
-        from django.db.models import Q
-        from django.contrib.admin.models import LogEntry
-
-        request = context['request']
-
-        def get_qset(list):
-            qset = None
-            for contenttype in list:
-                if isinstance(contenttype, ContentType):
-                    current_qset = Q(content_type__id=contenttype.id)
-                else:
-                    try:
-                        app_label, model = contenttype.split('.')
-                    except:
-                        raise ValueError('Invalid contenttype: "%s"' % contenttype)
-                    current_qset = Q(
-                        content_type__app_label=app_label,
-                        content_type__model=model
-                    )
-                if qset is None:
-                    qset = current_qset
-                else:
-                    qset = qset | current_qset
-            return qset
-
-        if request.user is None:
-            qs = LogEntry.objects.all()
-        else:
-            qs = LogEntry.objects.filter(user__id__exact=request.user.id)
-
-        if self.include_list:
-            qs = qs.filter(get_qset(self.include_list))
-        if self.exclude_list:
-            qs = qs.exclude(get_qset(self.exclude_list))
-
-        self.children = qs.select_related('content_type', 'user')[:self.limit]
-        if not len(self.children):
-            self.pre_content = _('No recent actions.')
-        self._initialized = True
-
-    def __unicode__(self):
-        return u'%s' % self.name
-
-    def name(self):
-        return 'recentactions'
-
-class Feed(DashboardModule):
-    """
-    Class that represents a feed dashboard module.
-
-    .. important::
-
-        This class uses the
-        `Universal Feed Parser module <http://www.feedparser.org/>`_ to parse
-        the feeds, so you'll need to install it, all feeds supported by
-        FeedParser are thus supported by the Feed
-
-    As well as the :class:`~admin_tools.dashboard.modules.DashboardModule`
-    properties, the :class:`~admin_tools.dashboard.modules.Feed` takes two
-    extra keyword arguments:
-
-    ``feed_url``
-        The URL of the feed.
-
-    ``limit``
-        The maximum number of feed children to display. Default value: None,
-        which means that all children are displayed.
-
-    Here's a small example of building a recent actions module::
-
-        from admin_tools.dashboard import modules, Dashboard
-
-        class MyDashboard(Dashboard):
-            def __init__(self, **kwargs):
-                Dashboard.__init__(self, **kwargs)
-
-                # will only list the django.contrib apps
-                self.children.append(modules.Feed(
-                    title=_('Latest Django News'),
-                    feed_url='http://www.djangoproject.com/rss/weblog/',
-                    limit=5
-                ))
-
-    The screenshot of what this code produces:
-
-    .. image:: images/feed_dashboard_module.png
-    """
-
-    title = _('RSS Feed')
-    template = 'admin_tools/dashboard/modules/feed.html'
-    feed_url = None
-    limit = None
-
-    def __init__(self, title=None, feed_url=None, limit=None, **kwargs):
-        kwargs.update({'feed_url': feed_url, 'limit': limit})
-        super(Feed, self).__init__(title, **kwargs)
-
-    def init_with_context(self, context):
-        if self._initialized:
-            return
-        import datetime
-        if self.feed_url is None:
-            raise ValueError('You must provide a valid feed URL')
-        try:
-            import feedparser
-        except ImportError:
-            self.children.append({
-                'title': ('You must install the FeedParser python module'),
-                'warning': True,
-            })
-            return
-
-        feed = feedparser.parse(self.feed_url)
-        if self.limit is not None:
-            entries = feed['entries'][:self.limit]
-        else:
-            entries = feed['entries']
-        for entry in entries:
-            entry.url = entry.link
-            try:
-                entry.date = datetime.date(*entry.updated_parsed[0:3])
-            except:
-                # no date for certain feeds
-                pass
-            self.children.append(entry)
-        self._initialized = True
-
-    def __unicode__(self):
-        return u'%s' % self.name
-
-    def name(self):
-        return 'feed'

build/lib/admin_tools/dashboard/registry.py

-#coding: utf-8
-
-class Registry(object):
-    """
-    Registry for application dashboards.
-    """
-    registry = {}
-
-    def register(cls, klass, app_name):
-        from admin_tools.dashboard.dashboards import Dashboard
-        if not issubclass(klass, Dashboard):
-            raise ValueError('%s is not an instance of Dashboard' % klass)
-        if app_name in cls.registry:
-            raise ValueError('A dashboard has already been registered for '
-                             'the application "%s"', app_name)
-        cls.registry[app_name] = klass
-    register = classmethod(register)
-
-
-def register(cls, *args, **kwargs):
-    """
-    Register a custom dashboard into the global registry.
-    """
-    Registry.register(cls, *args, **kwargs)
-
-
-def autodiscover(blacklist=[]):
-    """
-    Automagically discover custom dashboards and menus for installed apps.
-    Optionally you can pass a ``blacklist`` of apps that you don't want to
-    provide their own app index dashboard.
-    """
-    import imp
-    from django.conf import settings
-    from django.utils.importlib import import_module
-
-    blacklist.append('admin_tools.dashboard')
-    blacklist.append('admin_tools.menu')
-    blacklist.append('admin_tools.theming')
-
-    for app in settings.INSTALLED_APPS:
-        # skip blacklisted apps
-        if app in blacklist:
-            continue
-
-        # try to import the app
-        try:
-            app_path = import_module(app).__path__
-        except AttributeError:
-            continue
-
-        # try to find a app.dashboard module
-        try:
-            imp.find_module('dashboard', app_path)
-        except ImportError:
-            continue
-
-        # looks like we found it so import it !
-        import_module('%s.dashboard' % app)

build/lib/admin_tools/dashboard/static/admin_tools/css/dashboard-ie.css

-/* todo: ie6 doesn't want the dashboard to take full width... */
-
-html, body {
-    _overflow: auto;
-    _width: 100%;
-}
-
-#content {
-    *width: 98% !important;
-    _width: 96% !important;
-    margin: 1%;
-}
-
-#container {
-    _margin: 0;
-}
-
-.dashboard-module h2 a.toggle-icon,
-.dashboard-module h2 a.close-icon {
-    margin-top: -16px;
-}
-
-.dashboard-module ul li ul {
-    margin-top: -25px;
-}
-
-.dashboard-module h3 {
-    clear: both;
-}
-
-.dashboard-column {
-}

build/lib/admin_tools/dashboard/static/admin_tools/css/dashboard.css

-/* Utilities {{{ */
-
-.float-right {
-    float: right;
-}
-
-/* }}} */
-/* Dashboard general styles {{{ */
-
-.warning {
-    color: red;
-    background: transparent url(../images/admin-tools.png) 0 -412px no-repeat;
-    padding-left: 25px;
-}
-
-.dashboard #content {
-    display: block;
-    width: auto; !important;
-}
-
-.dashboard-container {
-    clear: both;
-}
-
-h1.dashboard-title {
-    float: left;
-}
-
-#dashboard-panel {
-    margin: 0 10px 0 0;
-    float: right;
-}
-
-#dashboard-panel h3 a {
-    padding: 5px;
-    min-width: 100px;
-    display: block;
-    text-align: center;
-    border: 1px solid #e5e5e5;
-    -moz-border-radius: 6px;
-    -webkit-border-radius: 6px;
-}
-
-#dashboard-panel ul {
-    display: none;
-    position: absolute;
-    top: auto;
-    right: 25px;
-    margin-top: -1px;
-}
-
-#dashboard-panel ul li {
-    padding: 5px;
-    border: 1px solid #e5e5e5;
-    background-color: white;