|
|
|
@ -39,6 +39,38 @@ def test_pay(request): |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class UnFreezeView(APIView): |
|
|
|
|
|
|
|
renderer_classes = (JSONRenderer,) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@staticmethod |
|
|
|
|
|
|
|
def post(request, id): |
|
|
|
|
|
|
|
if request.user.is_authenticated: |
|
|
|
|
|
|
|
try: |
|
|
|
|
|
|
|
bill = Bill.objects.get(id=id) |
|
|
|
|
|
|
|
bill.freeze = False |
|
|
|
|
|
|
|
bill.save() |
|
|
|
|
|
|
|
except Bill.DoesNotExist: |
|
|
|
|
|
|
|
return Response("Счёт не найден", status=404) |
|
|
|
|
|
|
|
return Response(status=204) |
|
|
|
|
|
|
|
return Response("Permission denied", status=403) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class FreezeView(APIView): |
|
|
|
|
|
|
|
renderer_classes = (JSONRenderer,) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@staticmethod |
|
|
|
|
|
|
|
def post(request, id): |
|
|
|
|
|
|
|
if request.user.is_authenticated: |
|
|
|
|
|
|
|
try: |
|
|
|
|
|
|
|
bill = Bill.objects.get(id=id) |
|
|
|
|
|
|
|
bill.freeze = True |
|
|
|
|
|
|
|
bill.save() |
|
|
|
|
|
|
|
except Bill.DoesNotExist: |
|
|
|
|
|
|
|
return Response("Счёт не найден", status=404) |
|
|
|
|
|
|
|
return Response(status=204) |
|
|
|
|
|
|
|
return Response("Permission denied", status=403) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class BillListView(APIView): |
|
|
|
class BillListView(APIView): |
|
|
|
renderer_classes = (JSONRenderer,) |
|
|
|
renderer_classes = (JSONRenderer,) |
|
|
|
|
|
|
|
|
|
|
|
|