Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Remove old JSONField from cart
Krzysztof Wolski63b1ec402869
diff --git a/saleor/cart/migrations/0006_auto_20161209_0750.py b/saleor/cart/migrations/0006_auto_20161209_0750.pynew file mode 100644index 0000000000..95b014ff24--- /dev/null+++ b/saleor/cart/migrations/0006_auto_20161209_0750.py@@ -0,0 +1,28 @@+# -*- coding: utf-8 -*-+# Generated by Django 1.10.3 on 2016-12-09 13:50+from __future__ import unicode_literals++from django.db import migrations+++class Migration(migrations.Migration):++ dependencies = [+ ('product', '0014_auto_20161209_0546'),+ ('cart', '0005_migrate_json_data'),+ ]++ operations = [+ migrations.AlterUniqueTogether(+ name='cartline',+ unique_together=set([('cart', 'variant', 'data_postgres')]),+ ),+ migrations.RemoveField(+ model_name='cart',+ name='checkout_data',+ ),+ migrations.RemoveField(+ model_name='cartline',+ name='data',+ ),+ ]diff --git a/saleor/cart/models.py b/saleor/cart/models.pyindex 9922cb5de3..0cb5e43e06 100644--- a/saleor/cart/models.py+++ b/saleor/cart/models.py@@ -12,9 +12,8 @@ from django.utils.encoding import python_2_unicode_compatible, smart_strfrom django.utils.timezone import nowfrom django.utils.translation import pgettext_lazyfrom django_prices.models import PriceField-from django.contrib.postgres.fields import JSONField as postgres_JSONField-from jsonfield import JSONField-from satchless.item import ItemLine, ItemSet, ItemList, partition+from django.contrib.postgres.fields import JSONField+from satchless.item import ItemLine, ItemList, partitionfrom ..discount.models import Voucherfrom ..product.models import ProductVariant@@ -101,8 +100,7 @@ class Cart(models.Model):primary_key=True, default=uuid4, editable=False)voucher = models.ForeignKey(Voucher, null=True, related_name='+', on_delete=models.SET_NULL)- checkout_data = JSONField(null=True, editable=False)- checkout_data_postgres = postgres_JSONField(null=True, editable=False)+ checkout_data_postgres = JSONField(null=True, editable=False)total = PriceField(currency=settings.DEFAULT_CURRENCY, max_digits=12, decimal_places=2,@@ -230,11 +228,10 @@ class CartLine(models.Model, ItemLine):quantity = models.PositiveIntegerField(pgettext_lazy('Cart line', 'quantity'),validators=[MinValueValidator(0), MaxValueValidator(999)])- data = JSONField(blank=True, default={})- data_postgres = postgres_JSONField(blank=True, default={})+ data_postgres = JSONField(blank=True, default={})class Meta:- unique_together = ('cart', 'variant', 'data')+ unique_together = ('cart', 'variant', 'data_postgres')def __str__(self):return smart_str(self.variant)