Skip to main content

Queryset can be filtered by a given list on the django admin page, just like: qs.filter(field__in=[list])

Project description

django-valueinlist-filter
=========================

Queryset can be filtered by a given list on the django admin page, just like: qs.filter(field__in=[list]).

Installation
------------

[sudo] pip install django-valueinlist-filter


Add valueinlist_filter to settings.INSTALLED_APPS:

INSTALLED_APPS = (
...
'valueinlist_filter'
)

And then, set a CharField field in a model like this:

class Model(models.Model):
...
serial_number = models.CharField(max_length=32)


If you want to filter the **serial_number** field by a given value list(split string by space), you can bind ValueInListFilter to this field:


from valueinlist_filter.filter import ValueInListFilter
from django.contrib import admin
from models import Model

class ModelAdmin(admin.ModelAdmin):
list_filter = (
('serial_number', ValueInListFilter), # bind filter to CharField
...
)

Finally, you will get a textarea form on the filter side bar, the textarea's change event will trigger form.

Added a 'screenshot.png' picture.

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-valueinlist-filter-0.1.3.tar.gz (3.0 kB view details)

Uploaded Source

File details

Details for the file django-valueinlist-filter-0.1.3.tar.gz.

File metadata

File hashes

Hashes for django-valueinlist-filter-0.1.3.tar.gz
Algorithm Hash digest
SHA256 e9ed9c3b4eee0c2e96c3d2699250eb318fa6da5baba52fabb916e76c2fb14d26
MD5 7b45024f0b44f0c37b5b07f7f72fc379
BLAKE2b-256 ddfea76c71698afae9088e4b00c0320f6cb1ee203f1704837a7635ad27ca8320

See more details on using hashes here.

Supported by

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