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.2.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | d1e52c5a5440d008c1823d698983b1274d0ba2377a748553f642bcbdfec17986 |
|
MD5 | a060dec2fd7581f4c2f62c37185b21e2 |
|
BLAKE2b-256 | ea786afcd00d650a91955f00fe89edd65443898dc20c0a39afa5687aee5c83f7 |
Close
Hashes for django-valueinlist-filter-0.1.2.linux-i686.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | f61234dd27d7a4183151e6f964b1ff1c2422e15bd71f3ed44ed90340daa5f2dd |
|
MD5 | 691a02ec03a12d74c54098a0ad137b4f |
|
BLAKE2b-256 | 9ad28e82f0e2d2bd7c4f834a6a71671c0ae9208fd7811235c38dd281c9a9e165 |