Skip to content

Instantly share code, notes, and snippets.

@folt
Created October 4, 2017 08:16
Show Gist options
  • Save folt/0940616db8676bd7f4feac25aad1c747 to your computer and use it in GitHub Desktop.
Save folt/0940616db8676bd7f4feac25aad1c747 to your computer and use it in GitHub Desktop.
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