Skip to content

moneypark/dynamicfilters

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

79 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 55.5%
  • JavaScript 39.9%
  • HTML 4.1%
  • CSS 0.5%