GithubHelp home page GithubHelp logo

roniemartinez / django-more-admin-filters Goto Github PK

View Code? Open in Web Editor NEW

This project forked from thomst/django-more-admin-filters

0.0 2.0 0.0 75 KB

Django-more-admin-filters is a collection of django admin filters with a focus on filters using dropdown widgets, multiple choice filters and filters working with annotated attributes.

License: BSD 3-Clause "New" or "Revised" License

Python 93.27% HTML 6.73%

django-more-admin-filters's Introduction

Welcome to django-more-admin-filters

Run tests for django-more-admin-filters coveralls badge python: 3.6, 3.7, 3.8, 3.9, 3.10 django: 2.2, 3.0, 3.1, 3.2, 4.0, 4.1

Description

Django-more-admin-filters is a collection of django admin filters with a focus on filters using dropdown widgets, multiple choice filters and filters working with annotated attributes.

Installation

Install from pypi.org:

pip install django-more-admin-filters

Add more_admin_filters to your installed apps:

INSTALLED_APPS = [
    'more_admin_filters',
    ...
]

Use the filter classes with your ModelAdmin:

from more_admin_filters import MultiSelectDropdownFilter

class MyModelAdmin(admin.ModelAdmin):
    ...
    list_filter = [
        ('myfield', MultiSelectDropdownFilter),
        ...
    ]

Since the ModelAdmin routine to initialize the list filters doesn't work with annotated attributes the usage for an annotation filter is a little bit special. The filter class needs to be equipped with the attribute's name:

MyModelAdmin(admin.ModelAdmin):
list_filter = [
    BooleanAnnotationFilter.init('my_annotated_attribute'),
    ...
]

Filter classes

  • DropdownFilter
    Dropdown filter for all kind of fields.
  • ChoicesDropdownFilter
    Dropdown filter for fields using choices.
  • RelatedDropdownFilter
    Dropdown filter for relation fields.
  • RelatedOnlyDropdownFilter
    Dropdown filter for relation fields using limit_choices_to.
  • MultiSelectFilter
    Multi select filter for all kind of fields.
  • MultiSelectRelatedFilter
    Multi select filter for relation fields.
  • MultiSelectRelatedOnlyFilter
    Multi select filter for related fields with choices limited to the objects involved in that relation
  • MultiSelectDropdownFilter
    Multi select dropdown filter for all kind of fields.
  • MultiSelectRelatedDropdownFilter
    Multi select dropdown filter for relation fields.
  • BooleanAnnotationFilter
    Filter for annotated boolean-attributes.

Note

More kind of annotation filters will be added in future versions.

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.