Skip to content

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

migrations

Pacu2b4191115af7b
diff --git a/saleor/discount/migrations/0010_auto_20180724_1251.py b/saleor/discount/migrations/0010_auto_20180724_1251.py
new file mode 100644
index 0000000000..371089936e
--- /dev/null
+++ b/saleor/discount/migrations/0010_auto_20180724_1251.py
@@ -0,0 +1,73 @@
+# Generated by Django 2.0.3 on 2018-07-24 17:51
+
+import datetime
+from django.db import migrations, models
+import django_countries.fields
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('product', '0065_auto_20180719_0520'),
+ ('discount', '0009_auto_20180719_0520'),
+ ]
+
+ operations = [
+ migrations.RenameField(
+ model_name='voucher',
+ old_name='limit',
+ new_name='min_amount_spent',
+ ),
+ migrations.RemoveField(
+ model_name='voucher',
+ name='apply_to',
+ ),
+ migrations.RemoveField(
+ model_name='voucher',
+ name='category',
+ ),
+ migrations.RemoveField(
+ model_name='voucher',
+ name='product',
+ ),
+ migrations.AddField(
+ model_name='sale',
+ name='end_date',
+ field=models.DateField(blank=True, null=True),
+ ),
+ migrations.AddField(
+ model_name='sale',
+ name='start_date',
+ field=models.DateField(default=datetime.date.today),
+ ),
+ migrations.AddField(
+ model_name='voucher',
+ name='apply_once_per_order',
+ field=models.BooleanField(default=False),
+ ),
+ migrations.AddField(
+ model_name='voucher',
+ name='categories',
+ field=models.ManyToManyField(blank=True, to='product.Category'),
+ ),
+ migrations.AddField(
+ model_name='voucher',
+ name='collections',
+ field=models.ManyToManyField(blank=True, to='product.Collection'),
+ ),
+ migrations.AddField(
+ model_name='voucher',
+ name='countries',
+ field=django_countries.fields.CountryField(blank=True, max_length=749, multiple=True),
+ ),
+ migrations.AddField(
+ model_name='voucher',
+ name='products',
+ field=models.ManyToManyField(blank=True, to='product.Product'),
+ ),
+ migrations.AlterField(
+ model_name='voucher',
+ name='type',
+ field=models.CharField(choices=[('value', 'All products'), ('product', 'Specific products'), ('collection', 'Specific collections of products'), ('category', 'Specific categories of products'), ('shipping', 'Shipping')], default='value', max_length=20),
+ ),
+ ]
diff --git a/saleor/discount/models.py b/saleor/discount/models.py
index d05abc38e4..151504ab76 100644
--- a/saleor/discount/models.py
+++ b/saleor/discount/models.py
@@ -52,7 +52,6 @@ class Voucher(models.Model):
default=DiscountValueType.FIXED)
discount_value = models.DecimalField(
max_digits=12, decimal_places=settings.DEFAULT_DECIMAL_PLACES)
- apply_once_per_customer = models.BooleanField(default=False)
# not mandatory fields, usage depends on type
countries = CountryField(multiple=True, blank=True)
min_amount_spent = MoneyField(
diff --git a/saleor/graphql/discount/resolvers.py b/saleor/graphql/discount/resolvers.py
index d587f30200..b011442e43 100644
--- a/saleor/graphql/discount/resolvers.py
+++ b/saleor/graphql/discount/resolvers.py
@@ -1,12 +1,10 @@
-from datetime import date
-
from ...discount import models
from ..utils import filter_by_query_param
VOUCHER_SEARCH_FIELDS = (
'name', 'code', 'discount_value', 'categories__name', 'collections__name',
'products__name', 'min_amount_spent', 'countries', 'discount_value_type',
- 'apply_one_per_order', 'apply_once_per_customer')
+ 'apply_one_per_order')
SALE_SEARCH_FIELDS = ('name', 'value', 'type')