Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Remove unused color attribute from AttributeChoiceValue
Anna Siwik835eb8e9bdb9
diff --git a/saleor/dashboard/product/forms.py b/saleor/dashboard/product/forms.pyindex 0e74ae833a..3e6fc7c1a8 100644--- a/saleor/dashboard/product/forms.py+++ b/saleor/dashboard/product/forms.py@@ -394,13 +394,11 @@ class ProductAttributeForm(forms.ModelForm):class AttributeChoiceValueForm(forms.ModelForm):class Meta:model = AttributeChoiceValue- fields = ['attribute', 'name', 'color']+ fields = ['attribute', 'name']widgets = {'attribute': forms.widgets.HiddenInput()}labels = {'name': pgettext_lazy(- 'Item name', 'Name'),- 'color': pgettext_lazy(- 'Color', 'Color')}+ 'Item name', 'Name')}def save(self, commit=True):self.instance.slug = slugify(self.instance.name)diff --git a/saleor/product/migrations/0062_sortable_models.py b/saleor/product/migrations/0062_sortable_models.pyindex 38f8ad6bce..7586316bd9 100644--- a/saleor/product/migrations/0062_sortable_models.py+++ b/saleor/product/migrations/0062_sortable_models.py@@ -36,5 +36,9 @@ class Migration(migrations.Migration):old_name='order',new_name='sort_order',),+ migrations.RemoveField(+ model_name='attributechoicevalue',+ name='color',+ ),migrations.RunPython(assign_sort_order_to_product_images, migrations.RunPython.noop)]diff --git a/saleor/product/models.py b/saleor/product/models.pyindex e7ef023b58..fd8103eea2 100644--- a/saleor/product/models.py+++ b/saleor/product/models.py@@ -268,9 +268,6 @@ class ProductAttribute(models.Model):class AttributeChoiceValue(SortableModel):name = models.CharField(max_length=100)slug = models.SlugField(max_length=100)- color = models.CharField(- max_length=7, blank=True,- validators=[RegexValidator('^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$')])attribute = models.ForeignKey(ProductAttribute, related_name='values', on_delete=models.CASCADE)diff --git a/templates/dashboard/product/product_attribute/detail.html b/templates/dashboard/product/product_attribute/detail.htmlindex df37618205..bb6a9e89a4 100644--- a/templates/dashboard/product/product_attribute/detail.html+++ b/templates/dashboard/product/product_attribute/detail.html@@ -76,7 +76,6 @@{% endif %}<th>{% trans "Display name" %}</th>- <th>{% trans "Color" %}</th>{% if perms.product.edit_product %}<th></th>{% endif %}@@ -93,13 +92,6 @@<td>{{ value.name }}</td>- <td>- {% if value.color %}- {{ value.color }}- {% else %}- -- {% endif %}- </td>{% if perms.product.edit_product %}<td class="right-align"><a href="{% url 'dashboard:product-attribute-value-update' attribute_pk=attribute.pk value_pk=value.pk %}" class="btn-flat waves-effect">diff --git a/tests/dashboard/test_product.py b/tests/dashboard/test_product.pyindex 9ff72c9416..4fae769abd 100644--- a/tests/dashboard/test_product.py+++ b/tests/dashboard/test_product.py@@ -875,7 +875,7 @@ def test_view_attribute_choice_value_create(color_attribute, admin_client):url = reverse('dashboard:product-attribute-value-add',kwargs={'attribute_pk': color_attribute.pk})- data = {'name': 'Pink', 'color': '#FFF', 'attribute': color_attribute.pk}+ data = {'name': 'Pink', 'attribute': color_attribute.pk}response = admin_client.post(url, data, follow=True)@@ -906,7 +906,7 @@ def test_view_attribute_choice_value_edit(color_attribute, admin_client):url = reverse('dashboard:product-attribute-value-update',kwargs={'attribute_pk': color_attribute.pk, 'value_pk': values[0].pk})- data = {'name': 'Pink', 'color': '#FFF', 'attribute': color_attribute.pk}+ data = {'name': 'Pink', 'attribute': color_attribute.pk}response = admin_client.post(url, data, follow=True)diff --git a/tests/test_graphql.py b/tests/test_graphql.pyindex d1974dbf47..5f63f88591 100644--- a/tests/test_graphql.py+++ b/tests/test_graphql.py@@ -549,7 +549,6 @@ def test_real_query(admin_client, product):idnameslug- color__typename}__typename