Skip to content

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

Remove variants name from form

Pacu2e0179389581e
diff --git a/saleor/dashboard/product/forms.py b/saleor/dashboard/product/forms.py
index 22b981ffa7..b6e9b7a8ab 100644
--- a/saleor/dashboard/product/forms.py
+++ b/saleor/dashboard/product/forms.py
@@ -139,7 +139,6 @@ class ProductTypeForm(forms.ModelForm):
attributes_changed = initial_attributes.intersection(saved_attributes)
if not attributes_changed:
return
- # TODO check if below filtering works properly
variants_to_be_updated = ProductVariant.objects.filter(
product__in=self.instance.products.all(),
product__product_type__variant_attributes__in=attributes_changed)
@@ -275,22 +274,14 @@ class ProductVariantForm(forms.ModelForm, AttributesMixin):
class Meta:
model = ProductVariant
- exclude = ['attributes', 'product', 'images']
+ exclude = ['attributes', 'product', 'images', 'name']
labels = {
'sku': pgettext_lazy('SKU', 'SKU'),
'price_override': pgettext_lazy(
- 'Override price', 'Override price'),
- 'name': pgettext_lazy('Product variant name', 'Name')}
- help_texts = {
- 'name': pgettext_lazy(
- 'Product variant help text',
- 'Variant\'s name is autogenerated, based on its attributes')}
+ 'Override price', 'Override price')}
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
- # Variant's name is generated from its attributes
- # should not be edited directly
- self.fields['name'].disabled = True
if self.instance.product.pk:
self.fields['price_override'].widget.attrs[
diff --git a/templates/dashboard/product/product_variant/form.html b/templates/dashboard/product/product_variant/form.html
index 28b9434510..d3c33517b6 100644
--- a/templates/dashboard/product/product_variant/form.html
+++ b/templates/dashboard/product/product_variant/form.html
@@ -73,9 +73,6 @@
{% csrf_token %}
<div class="row">
<div class="col s12 m8">
- <div class="row">
- {{ form.name|materializecss }}
- </div>
{% for attribute_field in form.iter_attribute_fields %}
<div class="row attribute-select-or-create">
{{ attribute_field|materializecss:"input-field s12" }}