Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Add DjangoJSONEncoder to Transaction gateway_response JSONField
Michał Jelonek339aafdf3358
diff --git a/saleor/payment/migrations/0005_auto_20181212_0551.py b/saleor/payment/migrations/0005_auto_20181212_0551.pynew file mode 100644index 0000000000..ffd1619b5b--- /dev/null+++ b/saleor/payment/migrations/0005_auto_20181212_0551.py@@ -0,0 +1,20 @@+# Generated by Django 2.1.3 on 2018-12-12 11:51++import django.contrib.postgres.fields.jsonb+import django.core.serializers.json+from django.db import migrations+++class Migration(migrations.Migration):++ dependencies = [+ ('payment', '0004_auto_20181206_0031'),+ ]++ operations = [+ migrations.AlterField(+ model_name='transaction',+ name='gateway_response',+ field=django.contrib.postgres.fields.jsonb.JSONField(encoder=django.core.serializers.json.DjangoJSONEncoder),+ ),+ ]diff --git a/saleor/payment/models.py b/saleor/payment/models.pyindex 8a53404ac2..26a0aa8944 100644--- a/saleor/payment/models.py+++ b/saleor/payment/models.py@@ -4,6 +4,7 @@ from operator import attrgetterfrom django.conf import settingsfrom django.contrib.postgres.fields import JSONFieldfrom django.core.validators import MaxValueValidator, MinValueValidator+from django.core.serializers.json import DjangoJSONEncoderfrom django.db import modelsfrom prices import Money@@ -214,7 +215,7 @@ class Transaction(models.Model):error = models.CharField(choices=[(tag, tag.value) for tag in TransactionError],max_length=256, null=True)- gateway_response = JSONField()+ gateway_response = JSONField(encoder=DjangoJSONEncoder)def __repr__(self):return 'Transaction(type=%s, is_success=%s, created=%s)' % (