lingo: add compatibility with jsonfield used on postgresql < 9.4 (#38857)
This commit is contained in:
parent
7050df871a
commit
fca2f06371
|
@ -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)
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue