summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrédéric Péters <fpeters@entrouvert.com>2020-01-11 17:00:46 (GMT)
committerFrédéric Péters <fpeters@entrouvert.com>2020-01-13 16:55:12 (GMT)
commitfca2f063713cb3da74690c70d6ed1a7f9d04c8ce (patch)
tree0287b05b9a5c6e03b08174be15bd23df9ab1db56
parent7050df871a3f932fb3eb826faf51a2bbc9ba1737 (diff)
downloadcombo-fca2f063713cb3da74690c70d6ed1a7f9d04c8ce.zip
combo-fca2f063713cb3da74690c70d6ed1a7f9d04c8ce.tar.gz
combo-fca2f063713cb3da74690c70d6ed1a7f9d04c8ce.tar.bz2
lingo: add compatibility with jsonfield used on postgresql < 9.4 (#38857)
-rw-r--r--combo/apps/lingo/models.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/combo/apps/lingo/models.py b/combo/apps/lingo/models.py
index 83b4ded..204530b 100644
--- a/combo/apps/lingo/models.py
+++ b/combo/apps/lingo/models.py
@@ -31,7 +31,7 @@ from django.conf import settings
from django.db import models
from django.forms import models as model_forms, Select
from django.utils.translation import ugettext_lazy as _
-from django.utils import timezone, dateparse
+from django.utils import timezone, dateparse, six
from django.core.mail import EmailMultiAlternatives
from django.core.urlresolvers import reverse
from django.core.exceptions import ObjectDoesNotExist, PermissionDenied
@@ -99,6 +99,13 @@ class PaymentBackend(models.Model):
return self.label
def get_payment(self):
+ if isinstance(self.service_options, six.string_types):
+ # backward compatibility when used againt postgresql < 9.4 and
+ # service_options is received as a string.
+ try:
+ self.service_options = json.loads(self.service_options)
+ except ValueError:
+ pass
return eopayment.Payment(self.service, self.service_options)