I have a model with a ManyToManyField. So, I have a endpoint to retrieve 
the list of this ManyToManyField. But I want filter the queryset with the 
GET parametters (CF: FilterClass). But What is the best practice to do that 

I have already a FilterClass for this model and it's 2 different models

Thank you,


def get_parts(self, request, set__idSet=None):
    my_set = self.get_object()
    queryset = my_set.mySetParts.all() # I want filter this queryset

    page = self.paginate_queryset(queryset)
    if page is not None:
        serializer = self.get_serializer(page, many=True)
        return self.get_paginated_response(serializer.data)
    serializer = self.get_serializer(queryset, many=True)
    return Response(serializer.data)

You received this message because you are subscribed to the Google Groups 
"Django REST framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-rest-framework+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to