looking for some solutions? You are welcome.

SOLVED: Check how many times a post was called

Jhon Caylog:

Based on my code below , that code in my program was called multiple times I want to know how we can track if how many times def post was called and get that count and return a single response return Response("You received 5(the total count def post was called) questionaire.", status=status.HTTP_200_OK) Instead of returning response everytime def post was called.Can we use a counter to detect how many times it was called ?

code

 def post(self, request):
                data = request.data
                print(data)
                questionaires_ins = QuestionaireModel.objects.get(random_code=data["random_code"])
                questionaires_ser = QuestionaireSerializer(questionaires_ins)
                questionaires_ser = questionaires_ser.data

                for applicant in data["users"]:
                    user_ins = User.objects.get(id=applicant["basic_info"]["user_id"])
                    user_ser = UserSerializer(user_ins)
             .......
                    email_ins = Email()
                    email_ins.share_questionaire_link(data_to_send)

                return Response("You received a questionaire.", status=status.HTTP_200_OK)



Posted in S.E.F
via StackOverflow & StackExchange Atomic Web Robots
Share:

No comments:

Recent