Hello to everyone, i have an issue filtering objects in my viewset (the GET method of the user endpoint).
The following is the code i used: """CUSTOM FILTERS""" class MultipleFieldLookupMixin(object): """ Apply this mixin to any view or viewset to get multiple field filtering based on a `lookup_fields` attribute, instead of the default single field filtering. """ def get_object(self): queryset = self.get_queryset() # Get the base queryset queryset = self.filter_queryset(queryset) # Apply any filter backends f = {} for field in self.lookup_fields: if field in self.kwargs.keys(): # Ignore empty fields. f[field] = self.kwargs[field] obj = get_object_or_404(queryset, f) # Lookup the object return obj class UserView(MultipleFieldLookupMixin, viewsets.ModelViewSet): queryset = User.objects.all() serializer_class = UserSerializer lookup_fields = ['username', 'pwd', 'token_confirm', 'email', 'token_cng_pwd'] I would like to list users optionally on any of these fields.. But when i open the url http://localhost/api/v3/user/?username=anything It always shows me the complete list of user.. What can i do to fix the problem? Thanks a lot Agnese Camellini -- 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. To view this discussion on the web visit https://groups.google.com/d/msgid/django-rest-framework/5943a785-0094-4749-b62d-6ddb18f56fafo%40googlegroups.com.