- from account.models import User
- import django_filters
- class UserFilter(django_filters.FilterSet):
- email = django_filters.CharFilter(lookup_expr="icontains")
- def get_users(filters=None):
- filters = filters or {}
- qs = User.objects.all()
- return UserFilter(filters, queryset=qs).qs
|