Last active
August 20, 2018 20:10
-
-
Save walison17/34f85805907db99ee9d7f6dc93000f9d to your computer and use it in GitHub Desktop.
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 SlugFilterBackend(filters.BaseFilterBackend): | |
def filter_queryset(self, request, queryset, view): | |
slug = request.query_params.get('slug') | |
if slug: | |
for s in slug.split(','): | |
queryset.filter(slug=s) | |
return queryset |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment