Skip to content

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

Fix style

Krzysztof Wolski234529dcac61
diff --git a/saleor/cart/models.py b/saleor/cart/models.py
index 7ea49c6ab0..f4d3aa019b 100644
--- a/saleor/cart/models.py
+++ b/saleor/cart/models.py
@@ -150,7 +150,6 @@ class Cart(models.Model):
def is_shipping_required(self):
return any(line.is_shipping_required() for line in self.lines.all())
- # Satchless
def __repr__(self):
return 'Cart(quantity=%s)' % (self.quantity,)
@@ -236,7 +235,6 @@ class CartLine(models.Model, ItemLine):
def __str__(self):
return smart_str(self.variant)
- # Satchless
def __eq__(self, other):
if not isinstance(other, CartLine):
return NotImplemented
diff --git a/saleor/cart/views.py b/saleor/cart/views.py
index a02e700dd4..c7afbffef7 100644
--- a/saleor/cart/views.py
+++ b/saleor/cart/views.py
@@ -105,8 +105,8 @@ def update(request, cart, variant_id):
def summary(request, cart):
def prepare_line_data(line):
- attributes = \
- line.variant.product.product_class.variant_attributes.all()
+ product_class = line.variant.product.product_class
+ attributes = product_class.variant_attributes.all()
first_image = line.variant.get_first_image()
price_per_item = line.get_price_per_item(discounts=request.discounts)
line_total = line.get_total(discounts=request.discounts)
diff --git a/saleor/dashboard/product/forms.py b/saleor/dashboard/product/forms.py
index d419879b86..eff44288b2 100644
--- a/saleor/dashboard/product/forms.py
+++ b/saleor/dashboard/product/forms.py
@@ -77,7 +77,7 @@ class ProductClassForm(forms.ModelForm):
if query.exists():
msg = pgettext_lazy(
'Product Class Errors',
- 'Products based on this class have more than '
+ 'Some products based on this class have more than '
'one variant.')
self.add_error('has_variants', msg)
return data
@@ -98,18 +98,18 @@ class ProductForm(forms.ModelForm):
field = self.fields['categories']
field.widget.attrs['data-placeholder'] = pgettext_lazy(
'Product form labels', 'Search')
- self.product_attributes = \
- self.instance.product_class.product_attributes.all()
+ product_class = self.instance.product_class
+ self.product_attributes = product_class.product_attributes.all()
self.product_attributes = self.product_attributes.prefetch_related(
'values')
self.prepare_fields_for_attributes()
def prepare_fields_for_attributes(self):
for attribute in self.product_attributes:
- field_defaults = {'label': attribute.display,
- 'required': False,
- 'initial': self.instance.get_attribute(
- attribute.pk)}
+ field_defaults = {
+ 'label': attribute.display,
+ 'required': False,
+ 'initial': self.instance.get_attribute(attribute.pk)}
if attribute.has_values():
field = CachingModelChoiceField(
queryset=attribute.values.all(), **field_defaults)