summaryrefslogtreecommitdiff
path: root/django/db/models/fields
diff options
context:
space:
mode:
authorJoseph Kocherhans <joseph@jkocherhans.com>2010-02-24 15:54:03 +0000
committerJoseph Kocherhans <joseph@jkocherhans.com>2010-02-24 15:54:03 +0000
commit9f4bf525f887db32b7260909a0140d68910aa042 (patch)
treea26ffb6b2ab107469490cc0a0e790fb6b106482d /django/db/models/fields
parentae43f651f2bfee0da8dbad6c22eba85ba4b168f6 (diff)
Fixed #12546. Objects with a __len__ that returns 0 can now be serialized. Thanks, casobn for the report and Alex Gaynor for the patch and tests.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12576 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django/db/models/fields')
-rw-r--r--django/db/models/fields/__init__.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/django/db/models/fields/__init__.py b/django/db/models/fields/__init__.py
index e9e3f4a0a3..05f16db9fe 100644
--- a/django/db/models/fields/__init__.py
+++ b/django/db/models/fields/__init__.py
@@ -404,7 +404,7 @@ class Field(object):
return first_choice + list(self.flatchoices)
def _get_val_from_obj(self, obj):
- if obj:
+ if obj is not None:
return getattr(obj, self.attname)
else:
return self.get_default()