Skip to content

Commit

Permalink
Fix #2 Define JSONField
Browse files Browse the repository at this point in the history
Since peewee>3.0 JSONField was moved to extensions modules for
both SQLite and Postgres. All we need is a generic one so we wrap
TextField.

Signed-off-by: David Brown <[email protected]>
  • Loading branch information
dmlb2000 committed Jan 3, 2019
1 parent 8a5c849 commit b0654a3
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions social_peewee/storage.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,20 @@
import six
import base64
import json

from peewee import CharField, IntegerField, Model, Proxy, IntegrityError
from playhouse.kv import JSONField

from peewee import CharField, IntegerField, Model, Proxy, IntegrityError, \
TextField
from social_core.storage import UserMixin, AssociationMixin, NonceMixin, \
CodeMixin, PartialMixin, BaseStorage

class JSONField(TextField):
def db_value(self, value):
return json.dumps(value)

def python_value(self, value):
if value is not None:
return json.loads(value)


def get_query_by_dict_param(cls, params):
query = True
Expand Down

0 comments on commit b0654a3

Please sign in to comment.