From ea19aca7adc52ffbb98326e5a4703ad2d968214d Mon Sep 17 00:00:00 2001 From: Nukeap <53114367+Nukeap@users.noreply.github.com> Date: Mon, 20 Jan 2025 10:35:45 +0300 Subject: [PATCH] fixname --- src/back/vote/views.py | 9 +++++---- src/front/src/components/vote/CurrentVote.vue | 4 ++-- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/back/vote/views.py b/src/back/vote/views.py index 4f585c6eb..733374370 100644 --- a/src/back/vote/views.py +++ b/src/back/vote/views.py @@ -86,17 +86,18 @@ class VoteDetail(generics.RetrieveUpdateDestroyAPIView): class VoteCreate(APIView): def post(self, request): + vote = self.create_vote(request) try: - vote = self.create_vote(request) self.create_news(request, vote) return Response({'status': 'success', 'message': 'Vote and news created successfully.'}, status=200) except Exception as e: + print(e) return Response({'status': 'error', 'message': str(e)}, status=400) def create_vote(self, request): user = request.user - + print(request.data) # for test # # user = DictEmployee.objects.get(login='9966-00-125') # # user = User.objects.get(user=user) @@ -124,7 +125,7 @@ class VoteCreate(APIView): break question = Question( - question=question_data['text'], + name=question_data['text'], vote=vote, file=question_image, numb=count, @@ -140,7 +141,7 @@ class VoteCreate(APIView): answer_image = file break Answer( - answer=answer['text'], + name=answer['text'], file=answer_image, question=question ).save() diff --git a/src/front/src/components/vote/CurrentVote.vue b/src/front/src/components/vote/CurrentVote.vue index 975f16248..74dca5e33 100644 --- a/src/front/src/components/vote/CurrentVote.vue +++ b/src/front/src/components/vote/CurrentVote.vue @@ -40,7 +40,7 @@
-
{{ question.question }}
+
{{ question.name }}
@@ -55,7 +55,7 @@ - {{ answer.answer }} + {{ answer.name }}