Skip to content

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

Fix failing attribute lookups

lampyjonad87cf107368
diff --git a/saleor/product/models/utils.py b/saleor/product/models/utils.py
index 2e5aef5e93..ac0e689189 100644
--- a/saleor/product/models/utils.py
+++ b/saleor/product/models/utils.py
@@ -1,9 +1,12 @@
+from django.utils.encoding import smart_text
+
def get_attributes_display_map(variant, attributes):
+ print "in get_attributes_display_map with " + str(variant) + " and " + str(attributes)
display = {}
for attribute in attributes:
value = variant.get_attribute(attribute.pk)
if value:
- choices = {a.pk: a for a in attribute.values.all()}
+ choices = {smart_text(a.pk): a for a in attribute.values.all()}
attr = choices.get(value)
if attr:
display[attribute.pk] = attr