Skip to main content

A generic filter for the django-admin-page based on django-filter.

Project description

https://api.travis-ci.org/thomst/django-admin-filter.svg?branch=master https://coveralls.io/repos/github/thomst/django-admin-filter/badge.svg?branch=master python: 3.4, 3.5, 3.6, 3.7, 3.8 django: 1.11, 2.0, 2.1, 2.2, 3.0

Description

Django-admin-filter is a generic form-based filter for the django-admin-page. It is based on django-filter. It provides a flexible and direct way to filter the items of your changelist and to save and reuse your queries.

Installation

Install from pypi.org:

pip install django-admin-filter

Configuration

There are three things you need to do to use a custom filter-form for your model in your admin changelist:

Add django_admin_filter to your INSTALLED_APPS:

INSTALLED_APPS = [
   'django_admin_filter',
   ...
]

Add the CustomFilter to the list_filter of your ModelAdmin:

from django_admin_filter.filters import CustomFilter

class MyAdmin(admin.ModelAdmin):
   list_filter = [CustomFilter, ...]
   ...

And setup the filter-class you want to use with your model. This works exactly as described in the django-filter-docs. But to use your filter-class with the django-admin-filter there is one thing to mind: Instead of subclass django_filters.FilterSet:

import django_filters

class MyFilter(django_filters.FilterSet):
   ...

use the AdminFilterSet:

from django_admin_filter.filterset import AdminFilterSet

class MyFilter(AdminFilterSet):
   ...

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django-admin-filter-0.2.tar.gz (9.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

django_admin_filter-0.2-py3-none-any.whl (12.4 kB view details)

Uploaded Python 3

File details

Details for the file django-admin-filter-0.2.tar.gz.

File metadata

  • Download URL: django-admin-filter-0.2.tar.gz
  • Upload date:
  • Size: 9.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.7.3

File hashes

Hashes for django-admin-filter-0.2.tar.gz
Algorithm Hash digest
SHA256 5d12ba0474e8d461d21a25309a9fd91cf9d52e310db6622cdc51e6a3e5000526
MD5 f2bbba053950d1bce36d1b23a2e02726
BLAKE2b-256 6fa9eabfb4b2c459c3708cfd3b3cfdf68f48cadf710e92f7c2a3f5fd21058cee

See more details on using hashes here.

File details

Details for the file django_admin_filter-0.2-py3-none-any.whl.

File metadata

  • Download URL: django_admin_filter-0.2-py3-none-any.whl
  • Upload date:
  • Size: 12.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.7.3

File hashes

Hashes for django_admin_filter-0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 c85051c47d258cbed4df8c130cf6da9715a262ba094ffa169f48d71df75bb54e
MD5 0ad46162e88937b4cc133614e5da348f
BLAKE2b-256 864236f14cc9a685d1a0ba42101e2f97ab59aa1fc914b32197f71224279a07b0

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page