Code Monkey home page Code Monkey logo

django-fluent-dashboard's Introduction

django-fluent-dashboard

The fluent_dashboard module offers a custom admin dashboard, built on top of django-admin-tools (docs).

The django-admin-tools package provides a default mechanism to replace the standard Django admin homepage with a widget based dashboard. The fluent_dashboard module extends this, by providing additional widgets (called "modules") such as:

  • a "icon list" module for the admin homepage.
  • a "welcome" module for the admin homepage.
  • a configurable module layout for the admin homepage, through settings.py.
  • a "return to site" link.
  • an optional "cache statistics" module.

Documentation can be found at: http://django-fluent-dashboard.readthedocs.org/

Screenshot

django-fluent-dashboard preview

Installation

First install the module, preferably in a virtual environment. It can be installed from PyPI:

pip install django-fluent-dashboard

Or the current folder can be installed:

pip install .

Configuration

Next, create a project which uses the CMS:

cd ..
django-admin.py startproject fluentdemo

It should have the following settings:

INSTALLED_APPS += (
    'fluent_dashboard',

    # enable the admin
    'admin_tools',
    'admin_tools.theming',
    'admin_tools.menu',
    'admin_tools.dashboard',
    'django.contrib.admin',
)

ADMIN_TOOLS_INDEX_DASHBOARD = 'fluent_dashboard.dashboard.FluentIndexDashboard'
ADMIN_TOOLS_APP_INDEX_DASHBOARD = 'fluent_dashboard.dashboard.FluentAppIndexDashboard'
ADMIN_TOOLS_MENU = 'fluent_dashboard.menu.FluentMenu'

For Django 1.3 the following setting is also required:

ADMIN_MEDIA_PREFIX = '/static/admin/'

Note that some admin_tools applications are optional, yet recommended to have the full experience of the module.

In urls.py:

urlpatterns += patterns('',
    url(r'^admintools/', include('admin_tools.urls')),
)

The database tables for admin_tools can be created afterwards:

./manage.py syncdb
./manage.py migrate    # If South is installed

Customizing the dashboard

Adding extra icons

The FLUENT_DASHBOARD_APP_ICONS setting is a dictionary that allows you to define extra icons for your own modules, and overwrite default settings. For example:

FLUENT_DASHBOARD_APP_ICONS = {
    'auth/user': "user.png"
}

The icon is expected to be 48x48 pixels. The icon name is treated in 3 different formats:

  • Absolute URLs are passed as-is.
  • Icon names with a / character, are relative to the STATIC_URL (or MEDIA_URL for Django 1.2).
  • Icon names without any path information, are relative to the current theme folder, e.g. STATIC_URL/fluent_dashboard/themename/

Organizing the application groups

The FLUENT_DASHBOARD_APP_GROUPS setting defines which applications are grouped. For example:

FLUENT_DASHBOARD_APP_GROUPS = (
    (_('CMS'), {
        'models': (
            'cms.*',
            'pages.*',
            'fiber.*',
        ),
        'module': 'CmsAppIconList',
        'collapsible': False,
    }),
    (_('Interactivity'), {
        'models': (
            'django.contrib.comments.*',
            'form_designer.*'
            'threadedcomments.*',
            'zinnia.*',
        ),
    }),
    (_('Administration'), {
        'models': (
            'django.contrib.auth.*',
            'django.contrib.sites.*',
            'google_analytics.*',
            'registration.*',
        ),
    }),
    (_('Applications'), {
        'models': ('*',),
        'module': 'AppList',
        'collapsible': True,
    }),
)

Details about these options, and additional settings are explained in the documentation.

Displaying cache status

This application features optional support for the dashboardmods package, which can display cache statistics. It can be installed using:

pip install dashboardmods

The application requires the cache backends to be configured, for example:

INSTALLED_APPS += (
    'dashboardmods',
)

# Example Memcache configuration:
CACHES = {
    'default': {
        'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache',
        'KEY_PREFIX': 'mysite.production',
        'LOCATION': '127.0.0.1:11211',
        'TIMEOUT': 24*3600,
    },
}

# Optional, example Varnish configuration:
VARNISH_MANAGEMENT_ADDRS = ('127.0.0.1:6082',)

When a cache is not configured, it will simply not be displayed by the module.

The following packages provide additional modules, which can be displayed at the dashboard:

  • django-admin-user-stats adds graphs to the dashboard, to see the number of registered users in the last month.
  • django-admin-tools-stats is derived from the previous package, and adds configurable graphs for any model type.
  • dashboardmods is detected to display cache statistics, but also features a configure RSS feed module.
  • django-admin-tools should not be forgotten, because it also provides modules for RSS feeds, link lists and tab grouping.

These modules can be integrated by subclassing the FluentIndexDashboard class, and point to that module with the ADMIN_TOOLS_INDEX_DASHBOARD setting.

Contributing

This module is designed to be generic. In case there is anything you didn't like about it, or think it's not flexible enough, please let us know. We'd love to improve it!

If you have any other valuable contribution, suggestion or idea, please let us know as well because we will look into it. Pull requests are welcome too. :-)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.