Bugfix: avoid error upon getting succesfully cancelled order

This commit is contained in:
Flávio Eler De Melo 2024-11-11 14:52:38 +01:00
parent 054093dea9
commit 52b2860699
No known key found for this signature in database
GPG Key ID: F76C2EBA538B8175

View File

@ -225,13 +225,13 @@ class OrderView(viewsets.ViewSet):
# 2) If order has been cancelled
if order.status == Order.Status.UCA:
return Response(
{"bad_request": "This order has been cancelled by the maker"},
status.HTTP_400_BAD_REQUEST,
{"status": "This order has been cancelled by the maker"},
status.HTTP_204_NO_CONTENT,
)
if order.status == Order.Status.CCA:
return Response(
{"bad_request": "This order has been cancelled collaborativelly"},
status.HTTP_400_BAD_REQUEST,
{"status": "This order has been cancelled collaborativelly"},
status.HTTP_204_NO_CONTENT,
)
data = ListOrderSerializer(order).data