Fixed #5574 -- Serialize a FileField using its filename from the database, not

external URL. The problem showed up when reloading the data. Patch from Chris
Henderson.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@7293 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Malcolm Tredinnick 2008-03-18 14:35:05 +00:00
parent 73328bf8ec
commit 5b8974c7b3
1 changed files with 4 additions and 6 deletions

View File

@ -60,8 +60,6 @@ class Serializer(object):
"""
if isinstance(field, models.DateTimeField):
value = getattr(obj, field.name).strftime("%Y-%m-%d %H:%M:%S")
elif isinstance(field, models.FileField):
value = getattr(obj, "get_%s_url" % field.name, lambda: None)()
else:
value = field.flatten_data(follow=None, obj=obj).get(field.name, "")
return smart_unicode(value)