Disallow cancelling an expired order

as per discussion on #165
This commit is contained in:
Tobias Kunze
2016-08-21 16:07:31 +02:00
parent 5667866c9d
commit 87a77989e7
4 changed files with 26 additions and 4 deletions

View File

@@ -142,7 +142,7 @@ def cancel_order(order, user=None):
if isinstance(user, int):
user = User.objects.get(pk=user)
with order.event.lock():
if order.status not in (Order.STATUS_PENDING, Order.STATUS_EXPIRED):
if order.status != Order.STATUS_PENDING:
raise OrderError(_('You cannot cancel this order.'))
order.status = Order.STATUS_CANCELLED
order.save()