I have this Code. But I need to display the values that exists in the database, Not like "It’s Exists in the Database", I need to display the values of that given email_id.
def post(request):
if request.method == 'GET':
value = example.objects.all()
email_id = request.GET.get('email_id', None)
if example.objects.filter(email_id = email_id).exists():
tutorials_serializer = exampleSerializer(value, many=True)
return JsonResponse(tutorials_serializer.data, safe=False)
Pls help me through it.
2
Answers
You could try this:
You’re almost there – You need to filter your
values
, not just check there is something in the filtered qs.