fixname
This commit is contained in:
1 parent
80453d4895
commit
ea19aca7ad
2 files changed
+7
-6
No files matched your search
@@ -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()
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
|
||||
<!-- <v-card class="d-flex flex-fill" > -->
|
||||
<div class="">
|
||||
<div class="" >{{ question.question }}</div>
|
||||
<div class="" >{{ question.name }}</div>
|
||||
|
||||
<v-row>
|
||||
<div class="v-col align-self-center ">
|
||||
@@ -55,7 +55,7 @@
|
||||
|
||||
<v-list-item density="compact" v-for="answer in question.answers" :key="answer.id"
|
||||
:value="answer.id">
|
||||
{{ answer.answer }}
|
||||
{{ answer.name }}
|
||||
<template v-slot:prepend="{ isSelected }">
|
||||
<v-list-item-action start>
|
||||
<v-checkbox-btn :model-value="isSelected"></v-checkbox-btn>
|
||||
|
||||
Reference in new issue
Block a user