Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fixed #5574 -- Serialize a FileField using its filename from the data…

…base, 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
  • Loading branch information...
commit 5b8974c7b3cbde2d63ddda8f3bddfa2637af5bb9 1 parent 73328bf
@malcolmt malcolmt authored
Showing with 4 additions and 6 deletions.
  1. +4 −6 django/core/serializers/base.py
View
10 django/core/serializers/base.py
@@ -22,10 +22,10 @@ class Serializer(object):
Abstract serializer base class.
"""
- # Indicates if the implemented serializer is only available for
+ # Indicates if the implemented serializer is only available for
# internal Django use.
internal_use_only = False
-
+
def serialize(self, queryset, **options):
"""
Serialize a queryset.
@@ -60,8 +60,6 @@ def get_string_value(self, obj, field):
"""
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)
@@ -162,9 +160,9 @@ def __repr__(self):
return "<DeserializedObject: %s>" % smart_str(self.object)
def save(self, save_m2m=True):
- # Call save on the Model baseclass directly. This bypasses any
+ # Call save on the Model baseclass directly. This bypasses any
# model-defined save. The save is also forced to be raw.
- # This ensures that the data that is deserialized is literally
+ # This ensures that the data that is deserialized is literally
# what came from the file, not post-processed by pre_save/save
# methods.
models.Model.save(self.object, raw=True)
Please sign in to comment.
Something went wrong with that request. Please try again.