Ticket #5619: get_filename_fix.diff

File get_filename_fix.diff, 933 bytes (added by wreese@…, 8 years ago)
  • db/models/base.py

     
    367367
    368368    def _get_FIELD_filename(self, field):
    369369        if getattr(self, field.attname): # value is not blank
    370             return os.path.join(settings.MEDIA_ROOT, getattr(self, field.attname))
     370            return os.path.join(settings.MEDIA_ROOT, field.get_filename(getattr(self, field.attname)))
    371371        return ''
    372372
    373373    def _get_FIELD_url(self, field):
    374374        if getattr(self, field.attname): # value is not blank
    375375            import urlparse
    376             return urlparse.urljoin(settings.MEDIA_URL, getattr(self, field.attname)).replace('\\', '/')
     376            return urlparse.urljoin(settings.MEDIA_URL, field.get_filename(getattr(self, field.attname))).replace('\\', '/')
    377377        return ''
    378378
    379379    def _get_FIELD_size(self, field):
Back to Top