A collection of addons for django-filter
Project description
django-filter-addons
A collection of addons for django-filter
Installation
Install the package from PyPi:
pip install django-filter-addons
Usage
Implement case-insensitivity on queryset ordering:
from django.contrib.auth.models import User
from django.db.models.functions import Lower
from django_filters.filters import CharFilter
from django_filters.filterset import FilterSet
from django_filters_addons.filters import OrderingFilter
class UserFilter(FilterSet):
account = CharFilter(field_name='username')
sort = OrderingFilter(
fields={'username': 'account', 'first_name': 'first_name', 'last_name': 'last_name', 'email': 'email'},
field_cases={'username': Lower, 'email': Lower},
)
class Meta:
model = User
fields = ('first_name', 'last_name', 'email')
License
django-filter-addons
is released under the MIT license.
Project details
Release history Release notifications | RSS feed
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-filter-addons-0.2.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 679968ac96746737beeb3ef932df5e52e6499e8deaf9daea91fb3056c1f80fa3 |
|
MD5 | eb38f34d8054fd9fdc010cb6d8e6298b |
|
BLAKE2b-256 | 2089b3a4a2dd416ce4e4f101df67d8cdb5b40c54fad6700bb206cc93733d9c30 |
Close
Hashes for django_filter_addons-0.2.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c7467a6f75156404a3fe0b8d72e410bda7a61ea196f1ac30dd0ea5a2b9174ee7 |
|
MD5 | 3ff0c1d465937283a6a37f1896c64f2c |
|
BLAKE2b-256 | e53024362bd7f599dcd3d275c6f404f7a13e6b04fcb0434cd1c936884891ca54 |