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
    )

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.0.tar.gz (2.0 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.0-py3-none-any.whl (3.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: django_input_filter-0.1.0.tar.gz
  • Upload date:
  • Size: 2.0 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.0.tar.gz
Algorithm Hash digest
SHA256 007473e50dad891f1c04f596ef6407e7bd927b4b034b02b4841f03ded91673aa
MD5 547e470b6e27e8782293918cf0a6e18e
BLAKE2b-256 6ebb7b3fae84fde649c96747cac37e5b9d20303a77015e0c66ea73939d0f7c25

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for django_input_filter-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 351e52ab7fd5596973d4a7a0d89fc86c1ba8d9b38a1a9adefb2c7bc7ceff320f
MD5 7f0966efa57a9d8fc825b1e22c96cea9
BLAKE2b-256 51a2e17ed8a5403abaf6a34150ba97a1bab2d88060634f65601b405d3c517ea8

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