Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSS

add filters in drf specifying specific fields

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 by www.django-rest-framework.org #
 
PREVIOUS NEXT
Tagged: #add #filters #drf #specific #fields
ADD COMMENT
Topic
Name
6+3 =