Skip to content

Commit

Permalink
Apply fixes from omab#898 to our fork
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrew committed Apr 25, 2016
1 parent f4fa73e commit fc9cfd7
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion social/apps/django_app/default/fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class JSONField(models.TextField):
"""

def __init__(self, *args, **kwargs):
kwargs.setdefault('default', '{}')
kwargs.setdefault('default', {})
super(JSONField, self).__init__(*args, **kwargs)

def to_python(self, value):
Expand All @@ -42,6 +42,9 @@ def to_python(self, value):
else:
return value

def from_db_value(self, value, expression, connection, context):
return self.to_python(value)

def validate(self, value, model_instance):
"""Check value is a valid JSON string, raise ValidationError on
error."""
Expand Down

0 comments on commit fc9cfd7

Please sign in to comment.