Facing use while declare custom Lookup field #9457
Unanswered
he-kishor
asked this question in
Question & Answer
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I am facing an issue while using lookup_field. I declared it as email, but when I request the method, it shows "not found". The email field has a unique constraint. However, when I use pk and search using pk, it shows me the user data.
views code is given below
class UserViewSetTesting(viewsets.ViewSet):
"""A simple ViewSet for listing or retreiving users"""
lookup_field = 'email'
def list(self,request):
queryset=User.objects.all()
serializer=UserSerializers(queryset, many=True)
return Response(serializer.data)
http://127.0.0.1:8000/api/usertesting/[email protected]
shows me not found while the email Id is correct
Beta Was this translation helpful? Give feedback.
All reactions