Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Fix unique_together constraint on stock model
Marcin Gębalab16dfc318f6e
diff --git a/saleor/product/migrations/0008_auto_20150617_0406.py b/saleor/product/migrations/0008_auto_20150617_0406.pynew file mode 100644index 0000000000..ecdf2bdf79--- /dev/null+++ b/saleor/product/migrations/0008_auto_20150617_0406.py@@ -0,0 +1,34 @@+# -*- coding: utf-8 -*-+from __future__ import unicode_literals++from django.db import models, migrations+from decimal import Decimal+import django.core.validators+++class Migration(migrations.Migration):++ dependencies = [+ ('product', '0007_auto_20150616_0852'),+ ]++ operations = [+ migrations.AddField(+ model_name='stock',+ name='quantity',+ field=models.IntegerField(default=Decimal('1'), verbose_name='quantity', validators=[django.core.validators.MinValueValidator(0)]),+ ),+ migrations.AlterField(+ model_name='stock',+ name='product',+ field=models.ForeignKey(editable=False, to='product.Product', verbose_name='product'),+ ),+ migrations.AlterUniqueTogether(+ name='stock',+ unique_together=set([('product', 'variant', 'location')]),+ ),+ migrations.RemoveField(+ model_name='stock',+ name='stock',+ ),+ ]diff --git a/saleor/product/models/base.py b/saleor/product/models/base.pyindex e85c7d2081..9e78ef86fc 100644--- a/saleor/product/models/base.py+++ b/saleor/product/models/base.py@@ -192,7 +192,7 @@ class Stock(models.Model):class Meta:app_label = 'product'- unique_together = ('product', 'variant', 'stock')+ unique_together = ('product', 'variant', 'location')def __str__(self):return self.product.name