Django

Code

Changeset 7293

Show
Ignore:
Timestamp:
03/18/08 09:35:05 (4 months ago)
Author:
mtredinnick
Message:

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.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/trunk/django/core/serializers/base.py

    r6922 r7293  
    2323    """ 
    2424 
    25     # Indicates if the implemented serializer is only available for  
     25    # Indicates if the implemented serializer is only available for 
    2626    # internal Django use. 
    2727    internal_use_only = False 
    28      
     28 
    2929    def serialize(self, queryset, **options): 
    3030        """ 
     
    6161        if isinstance(field, models.DateTimeField): 
    6262            value = getattr(obj, field.name).strftime("%Y-%m-%d %H:%M:%S") 
    63         elif isinstance(field, models.FileField): 
    64             value = getattr(obj, "get_%s_url" % field.name, lambda: None)() 
    6563        else: 
    6664            value = field.flatten_data(follow=None, obj=obj).get(field.name, "") 
     
    163161 
    164162    def save(self, save_m2m=True): 
    165         # Call save on the Model baseclass directly. This bypasses any  
     163        # Call save on the Model baseclass directly. This bypasses any 
    166164        # model-defined save. The save is also forced to be raw. 
    167         # This ensures that the data that is deserialized is literally  
     165        # This ensures that the data that is deserialized is literally 
    168166        # what came from the file, not post-processed by pre_save/save 
    169167        # methods.