|
|
|
|
@ -44,12 +44,13 @@ class FreezeView(APIView): |
|
|
|
|
|
|
|
|
|
@staticmethod |
|
|
|
|
def post(request, pk): |
|
|
|
|
if request.user.is_authenticated: |
|
|
|
|
try: |
|
|
|
|
bill = Bill.objects.get(id=pk) |
|
|
|
|
bill.freeze_course(request.user) |
|
|
|
|
except Bill.DoesNotExist: |
|
|
|
|
return Response("Счёт не найден", status=404) |
|
|
|
|
try: |
|
|
|
|
bill = Bill.objects.get(id=pk) |
|
|
|
|
except Bill.DoesNotExist: |
|
|
|
|
return Response("Счёт не найден", status=404) |
|
|
|
|
|
|
|
|
|
if request.user.is_authenticated and request.user.email == bill.user.email: |
|
|
|
|
bill.freeze_course() |
|
|
|
|
return Response(status=204) |
|
|
|
|
return Response("Permission denied", status=403) |
|
|
|
|
|
|
|
|
|
|