Browse Source

love too computer (jsonfield related hotfix)

master
alice 2 days ago
parent
commit
c2a55e8b5c
1 changed files with 5 additions and 0 deletions
  1. +5
    -0
      payments/models.py

+ 5
- 0
payments/models.py View File

@@ -4,6 +4,7 @@ from django.conf import settings
from django.utils.translation import ugettext_lazy as _
from jsonfield import JSONField
from datetime import timedelta
import json

from ccvpn.common import get_price
from .backends import BackendBase
@@ -103,6 +104,10 @@ class BackendData:
""" adds a backend data key to this instance's dict """
if not self.backend_data:
self.backend_data = {}

if isinstance(self.backend_data, str):
self.backend_data = json.loads(self.backend_data) or {}

if not isinstance(self.backend_data, dict):
raise Exception("self.backend_data is not a dict (%r)" % self.backend_data)
self.backend_data[key] = value


Loading…
Cancel
Save