Skip to content

Instantly share code, notes, and snippets.

@AndreasDickow
Created August 18, 2017 09:36
Show Gist options
  • Save AndreasDickow/7ac11725e6d6346071b8cd889e99192f to your computer and use it in GitHub Desktop.
Save AndreasDickow/7ac11725e6d6346071b8cd889e99192f to your computer and use it in GitHub Desktop.
Django Rest Filter exclude CSV in url
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