Add Filters In Drf Specifying Specific Fields

[Solved] Add Filters In Drf Specifying Specific Fields | Php Frameworks Drupal - Code Explorer | yomemimo.com
Question : add filters in drf specifying specific fields

Answered by : elias-imokhai

from django_filters.rest_framework import DjangoFilterBackend
class ProductList(generics.ListAPIView): queryset = Product.objects.all() serializer_class = ProductSerializer filter_backends = [DjangoFilterBackend] filterset_fields = ['category', 'in_stock']

Source : https://www.django-rest-framework.org/api-guide/filtering/ | Last Update : Mon, 18 Apr 22

Answers related to add filters in drf specifying specific fields

Code Explorer Popular Question For Php Frameworks Drupal