Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Use list for list of choices

Artur Smęt6f6eef6a7c97
diff --git a/saleor/dashboard/order/forms.py b/saleor/dashboard/order/forms.py
index 392451af81..793178ed99 100644
--- a/saleor/dashboard/order/forms.py
+++ b/saleor/dashboard/order/forms.py
@@ -270,8 +270,8 @@ class RemoveVoucherForm(forms.Form):
self.order.voucher = None
self.order.recalculate()
-ORDER_STATUS_CHOICES = (('', pgettext_lazy('Order status field value',
- 'All')),) + Status.CHOICES
+ORDER_STATUS_CHOICES = [('', pgettext_lazy('Order status field value',
+ 'All'))] + Status.CHOICES
PAYMENT_STATUS_CHOICES = (('', pgettext_lazy('Payment status field value',
'All')),) + PAYMENT_STATUS_CHOICES
diff --git a/saleor/order/__init__.py b/saleor/order/__init__.py
index 980694266a..c0790f44a1 100644
--- a/saleor/order/__init__.py
+++ b/saleor/order/__init__.py
@@ -8,10 +8,9 @@ class Status(object):
PAYMENT_PENDING = 'payment-pending'
FULLY_PAID = 'fully-paid'
- CHOICES = (
+ CHOICES = [
(NEW, pgettext_lazy('order status', 'Processing')),
(CANCELLED, pgettext_lazy('order status', 'Cancelled')),
(SHIPPED, pgettext_lazy('order status', 'Shipped')),
(PAYMENT_PENDING, pgettext_lazy('order status', 'Payment pending')),
- (FULLY_PAID, pgettext_lazy('order status', 'Fully paid')),
- )
+ (FULLY_PAID, pgettext_lazy('order status', 'Fully paid'))]
diff --git a/saleor/order/models.py b/saleor/order/models.py
index 12654f03db..3729a03780 100644
--- a/saleor/order/models.py
+++ b/saleor/order/models.py
@@ -169,7 +169,7 @@ class Order(models.Model, ItemSet):
return sum(costs[1:], costs[0])
def can_cancel(self):
- return self.status not in (Status.CANCELLED, Status.SHIPPED)
+ return self.status not in {Status.CANCELLED, Status.SHIPPED}
def recalculate(self):
prices = [group.get_total() for group in self