Skip to main content

Filter backend for DjangoRestFramework able to parse url parameters

Project description

https://badge.fury.io/py/drf-querystringfilter.png

Filter backend for DjangoRestFramework able to parse url parameters

Supports drf 3.5.x, 3.6.x, 3.7.x, 3.8.x Django 1.10.x, 1.11.x, 2.0.x, python 2.7, 3.6

Documentation

The full documentation is at https://drf-querystringfilter.readthedocs.org.

Basic Usage

class UserSerializer(ModelSerializer):
    class Meta:
        model = User
        exclude = ()


class Users(ListAPIView):
    serializer_class = UserSerializer
    filter_fields = ['username', 'email', 'is_staff', 'date_joined']
    filter_blacklist = None
    filter_backends = (QueryStringFilterBackend,)
    queryset = User.objects.all()

now you can query using…

- /users/?username=sax
- /users/?username__startswith=sa&date_joined__year=2000
- /users/?email__contains=@gmail.com
- /users/?is_staff=true

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

drf-querystringfilter-1.0.0.tar.gz (10.4 kB view details)

Uploaded Source

File details

Details for the file drf-querystringfilter-1.0.0.tar.gz.

File metadata

File hashes

Hashes for drf-querystringfilter-1.0.0.tar.gz
Algorithm Hash digest
SHA256 feae3c659ae24cf393a35cf3161e87f01a71b8d30bb2cdf90e1eb549ba23af4c
MD5 76ae63d6b53e8855fb2ff3a724304408
BLAKE2b-256 8c4a445ab7674f80b8b05e46c6ceffa7ea5b6b95c27b76915b1f8722c4bb4c5b

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page