Skip to content

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

Fix populatedb to generate slugs for attribute values

Marcin Gębala2405dcadfa75
diff --git a/saleor/core/utils/random_data.py b/saleor/core/utils/random_data.py
index f79a3f3ba9..3be8c995c4 100644
--- a/saleor/core/utils/random_data.py
+++ b/saleor/core/utils/random_data.py
@@ -271,10 +271,12 @@ def create_attribute(**kwargs):
def create_attribute_value(attribute, **kwargs):
+ display = fake.word()
defaults = {
- 'display': fake.word(),
- 'attribute': attribute}
+ 'attribute': attribute,
+ 'display': display}
defaults.update(kwargs)
+ defaults['slug'] = slugify(defaults['display'])
attribute_value = AttributeChoiceValue.objects.get_or_create(**defaults)[0]
return attribute_value