Ticket #12955: django-12955.diff

File django-12955.diff, 758 bytes (added by Sebastian Wiedenroth, 15 years ago)

following isagalaevs suggestion this patch fixed the problem for us

  • django/db/models/fields/files.py

    old new class FieldFile(File):  
    7373    def _get_size(self):
    7474        self._require_file()
    7575        if not self._committed:
    76             return len(self.file)
     76            return self.file.size
    7777        return self.storage.size(self.name)
    7878    size = property(_get_size)
    7979
    class FieldFile(File):  
    9393        setattr(self.instance, self.field.name, self.name)
    9494
    9595        # Update the filesize cache
    96         self._size = len(content)
     96        self._size = content.size
    9797        self._committed = True
    9898
    9999        # Save the object because it has changed, unless save is False
Back to Top