Skip to content
Autocomplete filter for Grappelli
Python JavaScript HTML CSS
Branch: master
Clone or download
Latest commit ff6ba22 Feb 22, 2016
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
dist version bump Apr 4, 2014
docs_img docs Mar 29, 2014
grappelli_filters Fixed filters Nov 21, 2014
.gitignore pypi package files Mar 29, 2014
LICENSE Initial commit Mar 22, 2014
MANIFEST.in pypi package files Mar 29, 2014
README.md Fix typo in README re INSTALLED_APPS Jun 29, 2015
README.rst removed non-ascii char Feb 15, 2016
setup.py Fix encoding error in setup with README May 20, 2014

README.md

django-grappelli-filters

Autocomplete filter for Grappelli

v 0.2.1 (usable, but only if you know why)

Filter for Foreign key and ManyToMany relations with AJAX autocomplete. Reuses features from Grappelli, works nicely along other filters and with both standard and sidebar filter template...

Screenshot

Installation

Put grappelli-filters in your PYTHONPATH.

Add 'grappelli_filters' to INSTALLED_APPS

Filters

Related Autocomplete Filter

This filter is similar to a regular foreign key field filter, with two differences:

  • it has a nice AJAX-powered autocomplete UI (straight from Grappelli)
  • does not load all possible filter values in HTML - good for situations with many of related objects
Usage

Configure Grappelli autocomplete feature as described here. Both Model method and SETTINGS value will work fine. For the inpatient, here is the SETTINGS value:

GRAPPELLI_AUTOCOMPLETE_SEARCH_FIELDS = {
    "myapp": {
        "mycategory": ("id__iexact", "name__icontains",),
    }
}

In admin.py add:

from grappelli_filters import RelatedAutocompleteFilter, FiltersMixin

class MyModelAdmin(FiltersMixin, admin.ModelAdmin):
    list_filter = ( ... ('field_name', RelatedAutocompleteFilter), ... )

Search Filter

This filter allows string searches over a single field. Several filters combined provide better control over the resulting list then does the built-in django-admin search_fields feature.

Usage

In admin.py add:

from grappelli_filters SearchFilter

class MyModelAdmin(admin.ModelAdmin):
    list_filter = ( ... ('field_name', SearchFilter), ... )

Case-sensitive Search Filter

Similar to Search Filter, but searches are case-sensitive.

Usage

Use SearchFilterC instead of SearchFilter

You can’t perform that action at this time.