Created
August 18, 2017 09:36
-
-
Save AndreasDickow/7ac11725e6d6346071b8cd889e99192f to your computer and use it in GitHub Desktop.
Django Rest Filter exclude CSV in url
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class NumberInFilter(django_filters.BaseInFilter, django_filters.NumberFilter): | |
pass | |
class UsernameFilter(filters.FilterSet): | |
username = django_filters.CharFilter(lookup_expr='icontains') | |
id = NumberInFilter(name='id', lookup_expr='in',exclude=True) | |
class Meta: | |
model = User | |
fields = ['username','id'] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment