Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #2 Define JSONField #3

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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