Giter Club home page Giter Club logo

django-grappelli-filters's Introduction

django-grappelli-filters

Autocomplete filter for Grappelli

v 0.3.0 (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

django-grappelli-filters's People

Watchers

 avatar

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.