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.
=========================
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
Built Distribution
Close
Hashes for django-valueinlist-filter-0.1.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 57ee502980ff223c997988c82ea002d274012579730b6aad25b0ec4a2f2ffb56 |
|
MD5 | f2144ff9d0c74a844790867325a14b4d |
|
BLAKE2b-256 | 8147676a5ccb354be26fce8a77a35894fc16be61e01251bc390bc10c9813bcf6 |
Close
Hashes for django-valueinlist-filter-0.1.1.linux-i686.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9983101dcf47cb2e49556f26c022cd83aab2693f46f9e0027ca12b2335cacb0e |
|
MD5 | ee3e2d585f82b26a9cb82cd149b9a1f3 |
|
BLAKE2b-256 | 925869174bb36c47b56c827888141632d35a5e3b46b9b2c97076fe4c6c7a6766 |