def getUser(request): if 'application/json' in request.META['CONTENT_TYPE']: name=json.loads(request.body).get('name') else: name=request.POST.get('name') user=transaction.objects.filter(user__username=name) serializer=transSerializer(user, many=True) return Response(serializer.data,status=status.HTTP_200_OK)
def getAllTrans(request): trans=transaction.objects.all() serializer=transSerializer(trans, many=True) return Response(serializer.data,status=status.HTTP_200_OK)