Commit 5b8974c7 authored by Malcolm Tredinnick's avatar Malcolm Tredinnick
Browse files

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
parent 73328bf8
Loading
Loading
Loading
Loading
+4 −6
Original line number Diff line number Diff line
@@ -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)