As I mentioned in heading, client side filter request comes in this pattern from tabulator data table to rest framework back end.
/?page=1&size=10&filters[0][field]=q&filters[0][type]=like&filters[0][value]=something
i have tried this way but it is not working
class MemberListSerializerView(generics.ListAPIView):
model = Membership
serializer_class = MemberSerializer
pagination_class = CustomPagination
def get_queryset(self):
queryset = Membership.objects.members()
query = self.request.query_params.get('filters[value][0]', None)
if query is not None:
queryset = queryset.filter(
Q(user__username__icontains=query) |
Q(user__first_name__icontains=query) |
Q(user__last_name__icontains=query)
)
return queryset
You can try looping through all the request get variables and extract data