Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Ignore mypy in JSONField imports
Marcin Gębala43262efc09bb
diff --git a/saleor/account/models.py b/saleor/account/models.pyindex eac5ef76b0..e46fb23480 100644--- a/saleor/account/models.py+++ b/saleor/account/models.py@@ -9,6 +9,7 @@ from django.contrib.auth.models import (PermissionsMixin,)from django.db import models+from django.db.models import JSONField # type: ignorefrom django.db.models import Q, QuerySet, Valuefrom django.forms.models import model_to_dictfrom django.utils import timezone@@ -232,7 +233,7 @@ class CustomerEvent(models.Model):],)order = models.ForeignKey("order.Order", on_delete=models.SET_NULL, null=True)- parameters = models.JSONField(blank=True, default=dict, encoder=CustomJsonEncoder)+ parameters = JSONField(blank=True, default=dict, encoder=CustomJsonEncoder)user = models.ForeignKey(User, related_name="events", on_delete=models.CASCADE)class Meta:diff --git a/saleor/checkout/models.py b/saleor/checkout/models.pyindex 73a2e8cba7..6bd845be77 100644--- a/saleor/checkout/models.py+++ b/saleor/checkout/models.py@@ -6,6 +6,7 @@ from uuid import uuid4from django.conf import settingsfrom django.core.validators import MinValueValidatorfrom django.db import models+from django.db.models import JSONField # type: ignorefrom django.utils.encoding import smart_strfrom django_countries.fields import Country, CountryFieldfrom django_prices.models import MoneyField@@ -177,7 +178,7 @@ class CheckoutLine(models.Model):"product.ProductVariant", related_name="+", on_delete=models.CASCADE)quantity = models.PositiveIntegerField(validators=[MinValueValidator(1)])- data = models.JSONField(blank=True, default=dict)+ data = JSONField(blank=True, default=dict)class Meta:unique_together = ("checkout", "variant", "data")diff --git a/saleor/core/db/fields.py b/saleor/core/db/fields.pyindex d6b6b9e113..81447aeea7 100644--- a/saleor/core/db/fields.py+++ b/saleor/core/db/fields.py@@ -1,7 +1,7 @@import jsonfrom typing import Callable-from django.db.models import JSONField+from django.db.models import JSONField # type: ignoreclass SanitizedJSONField(JSONField):diff --git a/saleor/core/models.py b/saleor/core/models.pyindex 334ec1944b..1de36ccd6a 100644--- a/saleor/core/models.py+++ b/saleor/core/models.py@@ -2,6 +2,7 @@ import datetimefrom typing import Anyfrom django.db import models+from django.db.models import JSONField # type: ignorefrom django.db.models import F, Max, Qfrom . import JobStatus@@ -75,12 +76,10 @@ class PublishableModel(models.Model):class ModelWithMetadata(models.Model):- private_metadata = models.JSONField(- blank=True, null=True, default=dict, encoder=CustomJsonEncoder- )- metadata = models.JSONField(+ private_metadata = JSONField(blank=True, null=True, default=dict, encoder=CustomJsonEncoder)+ metadata = JSONField(blank=True, null=True, default=dict, encoder=CustomJsonEncoder)class Meta:abstract = Truediff --git a/saleor/csv/models.py b/saleor/csv/models.pyindex 5344ef2603..56d13a8c48 100644--- a/saleor/csv/models.py+++ b/saleor/csv/models.py@@ -1,4 +1,5 @@from django.db import models+from django.db.models import JSONField # type: ignorefrom django.utils import timezonefrom ..account.models import User@@ -23,7 +24,7 @@ class ExportEvent(models.Model):date = models.DateTimeField(default=timezone.now, editable=False)type = models.CharField(max_length=255, choices=ExportEvents.CHOICES)- parameters = models.JSONField(blank=True, default=dict, encoder=CustomJsonEncoder)+ parameters = JSONField(blank=True, default=dict, encoder=CustomJsonEncoder)export_file = models.ForeignKey(ExportFile, related_name="events", on_delete=models.CASCADE)diff --git a/saleor/graphql/core/types/converter.py b/saleor/graphql/core/types/converter.pyindex 3480f92652..84f867fa44 100644--- a/saleor/graphql/core/types/converter.py+++ b/saleor/graphql/core/types/converter.py@@ -1,5 +1,5 @@import graphene-from django.db.models import JSONField+from django.db.models import JSONField # type: ignorefrom django_measurement.models import MeasurementFieldfrom django_prices.models import MoneyField, TaxedMoneyFieldfrom graphene.types.json import JSONStringdiff --git a/saleor/invoice/models.py b/saleor/invoice/models.pyindex a51503aacd..d8bd1c2e8a 100644--- a/saleor/invoice/models.py+++ b/saleor/invoice/models.py@@ -1,5 +1,6 @@from django.conf import settingsfrom django.db import models+from django.db.models import JSONField # type: ignorefrom django.utils.timezone import nowfrom ..core import JobStatus@@ -63,7 +64,7 @@ class InvoiceEvent(models.Model):on_delete=models.SET_NULL,related_name="+",)- parameters = models.JSONField(blank=True, default=dict, encoder=CustomJsonEncoder)+ parameters = JSONField(blank=True, default=dict, encoder=CustomJsonEncoder)class Meta:ordering = ("date", "pk")diff --git a/saleor/order/models.py b/saleor/order/models.pyindex ce3681c0ce..69cbd319ba 100644--- a/saleor/order/models.py+++ b/saleor/order/models.py@@ -7,6 +7,7 @@ from uuid import uuid4from django.conf import settingsfrom django.core.validators import MinValueValidatorfrom django.db import models+from django.db.models import JSONField # type: ignorefrom django.db.models import F, Max, Sumfrom django.utils.timezone import nowfrom django_measurement.models import MeasurementField@@ -506,7 +507,7 @@ class OrderEvent(models.Model):],)order = models.ForeignKey(Order, related_name="events", on_delete=models.CASCADE)- parameters = models.JSONField(blank=True, default=dict, encoder=CustomJsonEncoder)+ parameters = JSONField(blank=True, default=dict, encoder=CustomJsonEncoder)user = models.ForeignKey(settings.AUTH_USER_MODEL,blank=True,diff --git a/saleor/payment/models.py b/saleor/payment/models.pyindex a0fc9238f5..93688f6816 100644--- a/saleor/payment/models.py+++ b/saleor/payment/models.py@@ -5,6 +5,7 @@ from django.conf import settingsfrom django.core.serializers.json import DjangoJSONEncoderfrom django.core.validators import MaxValueValidator, MinValueValidatorfrom django.db import models+from django.db.models import JSONField # type: ignorefrom prices import Moneyfrom ..checkout.models import Checkout@@ -208,7 +209,7 @@ class Transaction(models.Model):null=True,)customer_id = models.CharField(max_length=256, null=True)- gateway_response = models.JSONField(encoder=DjangoJSONEncoder)+ gateway_response = JSONField(encoder=DjangoJSONEncoder)class Meta:ordering = ("pk",)diff --git a/saleor/plugins/models.py b/saleor/plugins/models.pyindex e1d30ae2ce..6fca708e26 100644--- a/saleor/plugins/models.py+++ b/saleor/plugins/models.py@@ -1,4 +1,5 @@from django.db import models+from django.db.models import JSONField # type: ignorefrom ..core.permissions import PluginsPermissionsfrom ..core.utils.json_serializer import CustomJsonEncoder@@ -9,7 +10,7 @@ class PluginConfiguration(models.Model):name = models.CharField(max_length=128)description = models.TextField(blank=True)active = models.BooleanField(default=True)- configuration = models.JSONField(+ configuration = JSONField(blank=True, null=True, default=dict, encoder=CustomJsonEncoder)diff --git a/saleor/product/models.py b/saleor/product/models.pyindex bdeabdc79b..9604624dc8 100644--- a/saleor/product/models.py+++ b/saleor/product/models.py@@ -4,6 +4,7 @@ from uuid import uuid4from django.conf import settingsfrom django.contrib.postgres.aggregates import StringAggfrom django.db import models+from django.db.models import JSONField # type: ignorefrom django.db.models import Case, Count, F, FilteredRelation, Q, Value, Whenfrom django.urls import reversefrom django.utils.encoding import smart_text@@ -44,7 +45,7 @@ class Category(MPTTModel, ModelWithMetadata, SeoModel):name = models.CharField(max_length=250)slug = models.SlugField(max_length=255, unique=True, allow_unicode=True)description = models.TextField(blank=True)- description_json = models.JSONField(blank=True, default=dict)+ description_json = JSONField(blank=True, default=dict)parent = models.ForeignKey("self", null=True, blank=True, related_name="children", on_delete=models.CASCADE)@@ -68,7 +69,7 @@ class CategoryTranslation(SeoModelTranslation):)name = models.CharField(max_length=128)description = models.TextField(blank=True)- description_json = models.JSONField(blank=True, default=dict)+ description_json = JSONField(blank=True, default=dict)class Meta:unique_together = (("language_code", "category"),)@@ -835,7 +836,7 @@ class Collection(SeoModel, ModelWithMetadata, PublishableModel):)background_image_alt = models.CharField(max_length=128, blank=True)description = models.TextField(blank=True)- description_json = models.JSONField(blank=True, default=dict)+ description_json = JSONField(blank=True, default=dict)translated = TranslationProxy()@@ -853,7 +854,7 @@ class CollectionTranslation(SeoModelTranslation):)name = models.CharField(max_length=128)description = models.TextField(blank=True)- description_json = models.JSONField(blank=True, default=dict)+ description_json = JSONField(blank=True, default=dict)class Meta:unique_together = (("language_code", "collection"),)