SergeyKubrak / dynamicfilters

Dynamic filters for django admin

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Adminfilters

Adminfilters introduces Redmine-like filters for Django admin application. It allows to plug and configure set of filter to any application model.

Setup

Examples directory has already configured application. To enable application, you need to add it to INSTALLED_APPS and 'adminfilters.middleware.CustomFiltersMiddleware' to MIDDLEWARE_CLASSES:

INSTALLED_APPS = (
    ...
    'adminfilters',
)
MIDDLEWARE_CLASSES = (
    ...
    'adminfilters.middleware.CustomFiltersMiddleware',
)

Also you need to inherit you model admin class from CustomFiltersAdmin, instead of admin.ModelAdmin:

from adminfilters.admin import CustomFiltersAdmin
from models import Category

class CategoryAdmin(CustomFiltersAdmin):
    list_fields = ('name',)

To disable adminfilters for current model admin, revert class inheritance back to admin.ModelAdmin.

Configuration

ADMINFILTERS_ADD_PARAM — parameter for adding new field to existing filters set.

ADMINFILTERS_LOAD_PARAM — parameter for loading existing filters set.

ADMINFILTERS_HEADER_TAG — HTML tag where rendered filters will be appeneded.

ADMINFILTERS_SAVE_PARAM — parameter to indicate save action of filters set for controller.

ADMINFILTERS_URLCONF — name of admin application's URLconf.

ADMINFILTERS_ADD_PARAM, ADMINFILTERS_LOAD_PARAM, ADMINFILTERS_SAVE_PARAM are basically fields, that indicate action for filters set management. They can be configured to avoid collissions with existing form fields or parameters.

About

Dynamic filters for django admin


Languages

Language:Python 55.5%Language:JavaScript 39.9%Language:HTML 4.1%Language:CSS 0.5%