Skip to main content

Django admin search filter

Latest PyPI version Latest Travis CI build status

Provides special type of django-admin list filter – search box with free user input allowed.

Some cases when you need such functionality:

  • You have a regular search box for general search (multilpe fields taken into account), but you sometimes need to search by a specific field.

  • You have a regular search box for flexible substring search, while sometimes you need to search by exact match. At the same time number of unique values for this field is too big to display them as choices filter (although in this particular case auto-complete could be a better option)

The solution provided by this package is you place special (configurable) search input as a list filter.

Idea is taken from this Medium article: https://hakibenita.medium.com/how-to-add-a-text-filter-to-django-admin-5d1db93772d8

Usage

# admin.py

from django_admin_search_filter import get_exact_equals_input_filter, get_icontains_input_filter

...

class SomeModelAdmin(...):
    ...
    list_filter = (
        ...

        get_icontains_input_filter(title_='name', attrs='name', ),  # Substring search, one field
        get_icontains_input_filter(title_='(alt)name', attrs=('name', 'alt_name') ), # Substring search, several fields

        get_exact_equals_input_filter(title_='ID of transaction', attrs='transaction_id', ),  # Exact search, one field
        get_exact_equals_input_filter('ID of transaction/sender/reciever',  # Exact search, several field
                                attrs=('transaction_id', 'sender_id', 'reciever_id' ))

    )

Will result in the following UI:

Alternative text

Installation

  1. pip install django-admin-search-filter

  2. Add "django_admin_search_filter" to django’s INSTALLED_APPS (to allow template to be loaded)

  3. Ensure APP_DIRS set to True in templates configuration

Requirements

  • Python 3

  • Django >= 2.2

Licence

MIT

Authors

django_admin_search_filter was written by Mikhail Koipish.

Metadata

Release files for django-admin-search-filter 0.1.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-admin-search-filter 0.1.3
File Size Uploaded
django_admin_search_filter-0.1.3.tar.gz 3.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for django-admin-search-filter 0.1.3
File Interpreter ABI Platform
django_admin_search_filter-0.1.3-py3-none-any.whl Python 3 none any Details

Total release size: 8.3 kB

Release files / django_admin_search_filter-0.1.3.tar.gz

Download URL django_admin_search_filter-0.1.3.tar.gz
Size 3.7 kB
Tags Source
SHA-256 checksum
How to use checksums
48753139de096a7e639cfbd8701665005120817d2e5b7ba5ca0e2d7f61f4b1c9
BLAKE2b-256 checksum
How to use checksums
55f304eb4d4f89cfb73611f3b143285cee7ab36290dbbcc92f605d993fbc8560
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.5.1 CPython/3.11.4 Darwin/21.6.0

Release files / django_admin_search_filter-0.1.3-py3-none-any.whl

Download URL django_admin_search_filter-0.1.3-py3-none-any.whl
Size 4.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d568657d2bc9c56c5b51556ca14d0ea09635514ee24adad63b15a512a7db5e82
BLAKE2b-256 checksum
How to use checksums
90e085a34438207e1eb5ee7290425171a36efb9d607d6ca247bd3b4691fb9147
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.5.1 CPython/3.11.4 Darwin/21.6.0

Release history Release notifications | RSS feed

This release

0.1.3 This release

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page