{"id":23616,"library":"djangorestframework-queryfields","title":"djangorestframework-queryfields","description":"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.","status":"active","version":"1.1.0","language":"python","source_language":"en","source_url":"https://github.com/wimglenn/djangorestframework-queryfields","tags":["django","django-rest-framework","query-parameters","field-selection"],"install":[{"cmd":"pip install djangorestframework-queryfields","lang":"bash","label":"pip install"}],"dependencies":[],"imports":[{"note":"The package name on PyPI is djangorestframework-queryfields, but the Python module is drf_queryfields.","wrong":"from rest_framework_queryfields import ...","symbol":"QueryFieldsSerializerMixin","correct":"from drf_queryfields import QueryFieldsSerializerMixin"}],"quickstart":{"code":"from drf_queryfields import QueryFieldsSerializerMixin\nfrom rest_framework import serializers\n\nclass MySerializer(QueryFieldsSerializerMixin, serializers.ModelSerializer):\n    class Meta:\n        model = MyModel\n        fields = '__all__'\n\n# View\nfrom rest_framework import generics\n\nclass MyListView(generics.ListAPIView):\n    serializer_class = MySerializer\n    queryset = MyModel.objects.all()\n\n# GET /api/my-model/?fields=id,name\n","lang":"python","description":"Basic usage of QueryFieldsSerializerMixin to allow field selection via query parameters."},"warnings":[{"fix":"Always ensure QueryFieldsSerializerMixin is the first base class: class MySerializer(QueryFieldsSerializerMixin, serializers.ModelSerializer):","message":"The mixin must be placed leftmost in the inheritance chain before the DRF serializer class. Otherwise, the field filtering will not work.","severity":"gotcha","affected_versions":"all"},{"fix":"Use 'from drf_queryfields import QueryFieldsSerializerMixin'.","message":"The package module name is 'drf_queryfields', not 'djangorestframework_queryfields' or 'rest_framework_queryfields'. Common import mistakes lead to ModuleNotFoundError.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Use 'from drf_queryfields import QueryFieldsSerializerMixin'.","cause":"Incorrect module name used in import.","error":"ModuleNotFoundError: No module named 'djangorestframework_queryfields'"},{"fix":"Change class MySerializer(serializers.ModelSerializer) to class MySerializer(QueryFieldsSerializerMixin, serializers.ModelSerializer).","cause":"Serializer does not include QueryFieldsSerializerMixin as the first base class.","error":"AttributeError: 'MySerializer' object has no attribute 'fields_filtered'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}