Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

[1.1.X] Fixed #13171 -- Corrected the field_subclassing unit test. Th…

…anks to Gabriel Hurley for the report and patch.

Backport of r12838 from trunk.

git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.1.X@12839 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 6e60c8b7c00ff29a6434a66af7522f438e92fd58 1 parent 7528565
@freakboy3742 freakboy3742 authored
View
10 tests/modeltests/field_subclassing/fields.py
@@ -48,23 +48,23 @@ def get_db_prep_lookup(self, lookup_type, value):
return [force_unicode(v) for v in value]
if lookup_type == 'isnull':
return []
- raise FieldError('Invalid lookup type: %r' % lookup_type)
+ raise TypeError('Invalid lookup type: %r' % lookup_type)
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
View
2  tests/modeltests/field_subclassing/models.py
@@ -51,7 +51,7 @@ class DataModel(models.Model):
>>> MyModel.objects.filter(data__lt=s)
Traceback (most recent call last):
...
-FieldError: Invalid lookup type: 'lt'
+TypeError: Invalid lookup type: 'lt'
# Serialization works, too.
>>> stream = serializers.serialize("json", MyModel.objects.all())
Please sign in to comment.
Something went wrong with that request. Please try again.