def put(self, usr, listId: str): ''' Add question to questionnary --- tags: -Flask API responses: 200: OK, JSON Format of the new list 404: NO OK, Erreur ''' body_parser = reqparse.RequestParser() body_parser.add_argument('question', type=str, required=True, help="Missing question") body_parser.add_argument('delai', type=int, required=True, help="Missing delai") args = body_parser.parse_args(strict=False) try: questionnary = Questionnary.objects(id=listId, usr=usr).first() if questionnary is None: return response(404,'Not Found', {"data": "questionnary id not found"}) question = Question(usr=usr, question=args['question'], reponse="",delai = args['delai']).save() questionnary.update(pushQuestionnary=question,usr=usr) newQuestionnary = Questionnary.objects(id=listId, usr=usr).first() return response(200, 'Success', {"question": question.asJson(),"newQuestionnary": newQuestionnary.jsoned()}) except Exception as error2: return response(400,str(error2),{"listId":listId})