Registry / web-framework / djangorestframework-queryfields

djangorestframework-queryfields

JSON →
library1.1.0pypypiunverified

A Django REST Framework extension that allows API consumers to request a subset of fields via query parameters (e.g., ?fields=id,name). Current version: 1.1.0. Maintenance cadence: low, with one release since its initial launch.

pip install djangorestframework-queryfields
INSTALL
IMPORT
SIG · DJANGORESTFRAMEWOR
D
djangorestframework-queryfields
web-frameworkpythonv1.1.0
Install
1.5s avg
Import
Disk
16MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v1.1.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.000s · 17.8MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 1.5s · import 0.000s · 18MB
16MB installed
● package 16MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

QueryFieldsSerializerMixin
from drf_queryfields import QueryFieldsSerializerMixin
from drf_queryfields import QueryFieldsSerializerMixin

Basic usage of QueryFieldsSerializerMixin to allow field selection via query parameters.

from drf_queryfields import QueryFieldsSerializerMixin from rest_framework import serializers class MySerializer(QueryFieldsSerializerMixin, serializers.ModelSerializer): class Meta: model = MyModel fields = '__all__' # View from rest_framework import generics class MyListView(generics.ListAPIView): serializer_class = MySerializer queryset = MyModel.objects.all() # GET /api/my-model/?fields=id,name
Debug
Known issues
gotchaThe mixin must be placed leftmost in the inheritance chain before the DRF serializer class. Otherwise, the field filtering will not work.
fix
Always ensure QueryFieldsSerializerMixin is the first base class: class MySerializer(QueryFieldsSerializerMixin, serializers.ModelSerializer):
affects: all
gotchaThe package module name is 'drf_queryfields', not 'djangorestframework_queryfields' or 'rest_framework_queryfields'. Common import mistakes lead to ModuleNotFoundError.
fix
Use 'from drf_queryfields import QueryFieldsSerializerMixin'.
affects: all
Upgrade
Version history
1.1.0latest on PyPI · released Nov 22, 2023
Audit
Dependencies

No dependency data recorded yet.

Agent activity
12 hits · last 30 days
node
12
Resources
djangorestframework-queryfields — pip install djangorestframework-queryfields · libregistry