So I created my \"API\" using REST framework, now trying to do filtering for it.
That\'s how my models.py look like more or less:
class Airline(
You can get the same functionality out of the box just by using django-filter package as stated in the docs http://www.django-rest-framework.org/api-guide/filtering/#djangofilterbackend
from rest_framework import filters
class PassengerList(generics.ListCreateAPIView):
model = Passenger
serializer_class = PassengerSerializer
queryset = Passenger.objects.all()
filter_backends = (filters.DjangoFilterBackend,)
filter_fields = ('workspace', 'workspace__airline')
In this case you will have to make filtering using 'workspace=1' or 'workspace__airline=1'