Giter Club home page Giter Club logo

django-adminfilters's Introduction

django-adminfilters

Collection of extra filters for the Django admin site

Demo can be found at https://django-adminfilters.herokuapp.com/demo/artist/

Pypi coverage Test ReadTheDocs

adminfilters.mp4

Filters

  • Autocomplete
    • AutocompleteFilter
  • Simple
    • ValueFilter
  • Combobox
    • AllValuesComboFilter
    • RelatedFieldComboFilter
    • ChoicesFieldComboFilter
  • Dates
    • DateRangeFilter
  • Radio
    • AllValuesRadioFilter
    • RelatedFieldRadioFilter
    • ChoicesFieldRadioFilter
    • BooleanRadioFilter
  • Checkbox
    • RelatedFieldCheckBoxFilter
  • Multiple
    • MultiValueFilter
  • ManyToMany
    • IntersectionFieldListFilter
    • UnionFieldListFilter
  • JSON
    • JsonFieldFilter
  • Number
    • NumberFilter
  • Special
    • QueryStringFilter
    • DjangoLookupFilter
    • PermissionPrefixFilter

FYI

Filters management (save/retrieve), is handled by an optional application adminfilters.depot that, due to the Django filters internal design, it uses GET method to save filter definition to the database. When you use FilterDepotManager to save a filter, the call is idempotent but not safe.

Usage examples

class MyModel(models.Model):
    index = models.CharField(max_length=255)
    name = models.CharField(max_length=255)
    age = models.IntegerField()
    flag = models.CharField(default="1", choices=(("0", "Flag 1"), ("1", "Flag 2"))
    household = models.ForeignKey('Household')
    custom = JSONField(default=dict, blank=True)

class MyModelAdmin(ModelAdmin):
    list_filter = (
        FilterDepotManager,  # needs `adminfilters.depot` app
        QueryStringFilter,
        DjangoLookupFilter,
        ("custom", JsonFieldFilter.factory(can_negate=False, options=True)),
        ("flag", ChoicesFieldComboFilter),
        ('household', AutoCompleteFilter)
        ('name', ValueFilter.factory(lookup='istartswith'),
        ("age", NumberFilter),
    )

Run demo app

$ git clone https://github.com/saxix/django-adminfilters.git
$ cd django-adminfilters
$ python3 -m venv .venv
$ source .venv/bin/activate
$ make develop
$ make demo

Project links

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.