Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Fit slug fields length to name length
Anna Siwikad146496efe4
diff --git a/saleor/dashboard/collection/forms.py b/saleor/dashboard/collection/forms.pyindex 5b9d0f5ce9..2988f32ddf 100644--- a/saleor/dashboard/collection/forms.py+++ b/saleor/dashboard/collection/forms.py@@ -31,5 +31,4 @@ class CollectionForm(forms.ModelForm):def save(self, commit=True):self.instance.slug = slugify(unidecode(self.instance.name))- super().save(commit=commit)- return self.instance+ return super().save(commit=commit)diff --git a/saleor/product/migrations/0052_slug_field_length.py b/saleor/product/migrations/0052_slug_field_length.pynew file mode 100644index 0000000000..e9f5d26ca2--- /dev/null+++ b/saleor/product/migrations/0052_slug_field_length.py@@ -0,0 +1,28 @@+# Generated by Django 2.0.2 on 2018-02-28 11:22++from django.db import migrations, models+++class Migration(migrations.Migration):++ dependencies = [+ ('product', '0051_auto_20180202_1106'),+ ]++ operations = [+ migrations.AlterField(+ model_name='attributechoicevalue',+ name='slug',+ field=models.SlugField(max_length=100),+ ),+ migrations.AlterField(+ model_name='category',+ name='slug',+ field=models.SlugField(max_length=128),+ ),+ migrations.AlterField(+ model_name='collection',+ name='slug',+ field=models.SlugField(max_length=128),+ ),+ ]diff --git a/saleor/product/models.py b/saleor/product/models.pyindex e6b9400de0..0e6c9ac0e3 100644--- a/saleor/product/models.py+++ b/saleor/product/models.py@@ -24,7 +24,7 @@ from .utils import get_attributes_display_mapclass Category(MPTTModel):name = models.CharField(max_length=128)- slug = models.SlugField(max_length=50)+ slug = models.SlugField(max_length=128)description = models.TextField(blank=True)parent = models.ForeignKey('self', null=True, blank=True, related_name='children',@@ -335,7 +335,7 @@ class ProductAttribute(models.Model):class AttributeChoiceValue(models.Model):name = models.CharField(max_length=100)- slug = models.SlugField()+ 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})$')])@@ -389,7 +389,7 @@ class VariantImage(models.Model):class Collection(models.Model):name = models.CharField(max_length=128, unique=True)- slug = models.SlugField(max_length=255)+ slug = models.SlugField(max_length=128)products = models.ManyToManyField(Product, blank=True, related_name='collections')