Created
October 4, 2017 08:16
-
-
Save folt/0940616db8676bd7f4feac25aad1c747 to your computer and use it in GitHub Desktop.
This file contains 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 SimpleFilterBackend(BaseFilterBackend): | |
def get_schema_fields(self, view): | |
return [coreapi.Field( | |
name='query', | |
location='query', | |
required=False, | |
type='string' | |
)] | |
class MyViewSet(viewsets.ViewSet): | |
filter_backends = (SimpleFilterBackend,) | |
def list(self, request, *args, **kwargs): | |
return Response({'hello': 'world'}, status.HTTP_200_OK) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment