Ticket #5160: base.py.diff

File base.py.diff, 664 bytes (added by Esaj, 8 years ago)

Escape spaces in generated URL using urllib.quote

  • django/db/models/base.py

     
    358358
    359359    def _get_FIELD_url(self, field):
    360360        if getattr(self, field.attname): # value is not blank
    361             import urlparse
    362             return urlparse.urljoin(settings.MEDIA_URL, getattr(self, field.attname)).replace('\\', '/')
     361            import urlparse, urllib
     362            return urllib.quote(urlparse.urljoin(settings.MEDIA_URL, getattr(self, field.attname)).replace('\\', '/'))
    363363        return ''
    364364
    365365    def _get_FIELD_size(self, field):
Back to Top