1
0
mirror of https://github.com/django/django.git synced 2025-10-24 06:06:09 +00:00

Migrated the field_subclsasing doctests. Thanks to Alex Gaynor.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@13780 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Russell Keith-Magee
2010-09-12 20:03:48 +00:00
parent 521be8cd9c
commit e2e1802e48
3 changed files with 63 additions and 63 deletions

View File

@@ -53,18 +53,18 @@ class SmallField(models.Field):
class JSONField(models.TextField):
__metaclass__ = models.SubfieldBase
description = ("JSONField automatically serializes and desializes values to "
"and from JSON.")
def to_python(self, value):
if not value:
return None
if isinstance(value, basestring):
value = json.loads(value)
return value
def get_db_prep_save(self, value):
if value is None:
return None