Skip to main content

A django library for input filters

Project description

Django Input Filter

A Django library for creating advanced input filters in admin interfaces.

Installation

Install the package using pip:

pip install django-input-filter

Configuration

Add django_input_filter to your INSTALLED_APPS in settings.py:

INSTALLED_APPS = [
    ...
    'django_input_filter',
    ...
]

Usage Example

from django_input_filter import InputFilter

class NameContainsInputFilter(InputFilter):
    title = "Name Contains Filter"
    parameter_name = "name_contains"

    def queryset(self, request, queryset):
        term = self.value()
        if term is None:
            return queryset
        return queryset.filter(name__icontains=term)
@admin.register(ModelName)
class ModelNameAdmin(admin.ModelAdmin):
    ...
    list_filter = (
        ...
        NameContainsInputFilter
    )

How the Filter Looks

Input Filter Screenshot

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_input_filter-0.1.2.tar.gz (2.1 kB view details)

Uploaded Source

Built Distribution

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

django_input_filter-0.1.2-py3-none-any.whl (3.1 kB view details)

Uploaded Python 3

File details

Details for the file django_input_filter-0.1.2.tar.gz.

File metadata

  • Download URL: django_input_filter-0.1.2.tar.gz
  • Upload date:
  • Size: 2.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.1 CPython/3.10.6 Windows/10

File hashes

Hashes for django_input_filter-0.1.2.tar.gz
Algorithm Hash digest
SHA256 b94dc91de72de2c46ee9e6eb6892afc992def8f8701d629e3c312af47d4dfb92
MD5 a836ed2ca69c6f63a3fa3d0b772ff8f8
BLAKE2b-256 5d3e49e2a1a6b1d117d84167fe791abecde7337d3d40f656795ae13b811e884e

See more details on using hashes here.

File details

Details for the file django_input_filter-0.1.2-py3-none-any.whl.

File metadata

File hashes

Hashes for django_input_filter-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 f1f62d3535ed4f965bb9b085266c664c736dc1286d389c7673bce7b3fd01bf95
MD5 bf9e98775d2e3d64c7882561f3b8cb0e
BLAKE2b-256 4b5fb8ad7248e5d2ae520fe49af8638637f4265efad5091259f5bf891ea61386

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