Skip to content

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

Add slug field to collection

Mira Szewczyk8a7233a1a32d
diff --git a/saleor/product/migrations/0026_auto_20170102_0927.py b/saleor/product/migrations/0026_auto_20170110_0351.py
similarity index 61%
rename from saleor/product/migrations/0026_auto_20170102_0927.py
rename to saleor/product/migrations/0026_auto_20170110_0351.py
index 99090deb85..62e6d681f0 100644
--- a/saleor/product/migrations/0026_auto_20170102_0927.py
+++ b/saleor/product/migrations/0026_auto_20170110_0351.py
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
-# Generated by Django 1.10.3 on 2017-01-02 15:27
+# Generated by Django 1.10.3 on 2017-01-10 09:51
from __future__ import unicode_literals
from django.db import migrations, models
@@ -16,8 +16,9 @@ class Migration(migrations.Migration):
name='Collection',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
- ('name', models.CharField(max_length=128, verbose_name='name', unique=True,)),
- ('products', models.ManyToManyField(to='product.Product')),
+ ('name', models.CharField(max_length=128, unique=True, verbose_name='name')),
+ ('slug', models.SlugField(verbose_name='slug')),
+ ('products', models.ManyToManyField(blank=True, to='product.Product')),
],
),
]
diff --git a/saleor/product/models.py b/saleor/product/models.py
index 6c4e86f0be..e31c340a92 100644
--- a/saleor/product/models.py
+++ b/saleor/product/models.py
@@ -382,6 +382,7 @@ class Collection(models.Model):
name = models.CharField(
pgettext_lazy('Product collection field', 'name'), max_length=128,
unique=True)
+ slug = models.SlugField(pgettext_lazy('Product collection field', 'slug'))
products = models.ManyToManyField(Product, blank=True)
def __str__(self):