Skip to content

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

Fix function to get attributes display

Marcin Gębala351b966a2497
diff --git a/saleor/product/models/base.py b/saleor/product/models/base.py
index db1540ee6a..a811b6f49d 100644
--- a/saleor/product/models/base.py
+++ b/saleor/product/models/base.py
@@ -175,8 +175,8 @@ class ProductVariant(models.Model, Item):
def get_attributes_display(self):
display = {}
for attr_pk, value in self.attributes.iteritems():
- attribute = ProductAttribute.objects.get(pk=attr_pk)
- if self.product.attributes.filter(pk=attribute.pk):
+ if self.product.attributes.filter(pk=attr_pk):
+ attribute = ProductAttribute.objects.get(pk=attr_pk)
if attribute.has_values():
try:
value = attribute.values.get(pk=value)