Update views.py
This commit is contained in:
1 parent
ea19aca7ad
commit
7b130a4350
1 file changed
+2
-2
@@ -86,8 +86,8 @@ class VoteDetail(generics.RetrieveUpdateDestroyAPIView):
|
|||||||
|
|
||||||
class VoteCreate(APIView):
|
class VoteCreate(APIView):
|
||||||
def post(self, request):
|
def post(self, request):
|
||||||
vote = self.create_vote(request)
|
|
||||||
try:
|
try:
|
||||||
|
vote = self.create_vote(request)
|
||||||
self.create_news(request, vote)
|
self.create_news(request, vote)
|
||||||
return Response({'status': 'success', 'message': 'Vote and news created successfully.'}, status=200)
|
return Response({'status': 'success', 'message': 'Vote and news created successfully.'}, status=200)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
@@ -97,7 +97,7 @@ class VoteCreate(APIView):
|
|||||||
def create_vote(self, request):
|
def create_vote(self, request):
|
||||||
|
|
||||||
user = request.user
|
user = request.user
|
||||||
print(request.data)
|
|
||||||
# for test
|
# for test
|
||||||
# # user = DictEmployee.objects.get(login='9966-00-125')
|
# # user = DictEmployee.objects.get(login='9966-00-125')
|
||||||
# # user = User.objects.get(user=user)
|
# # user = User.objects.get(user=user)
|
||||||
|
|||||||
Reference in new issue
Block a user