Ticket #914: absolute_include_admin_script-r4185.diff

File absolute_include_admin_script-r4185.diff, 1.1 KB (added by mhf@…, 18 years ago)

Patch (against r4185), which uses urljoin

  • django/contrib/admin/templatetags/admin_modify.py

     
    77from django.db.models.related import BoundRelatedObject
    88from django.conf import settings
    99import re
     10from urlparse import urljoin
    1011
    1112register = template.Library()
    1213
     
    2728    could return::
    2829
    2930        <script type="text/javascript" src="/media/admin/js/calendar.js">
     31
     32    or (if you use an absolute path)::
     33
     34        {% include_admin_script /myjs/other.js %}
     35
     36    could return::
     37
     38        <script type="text/javascript" src="/myjs/other.js">
    3039    """
    3140
    32     return '<script type="text/javascript" src="%s%s"></script>' % (settings.ADMIN_MEDIA_PREFIX, script_path)
     41    return '<script type="text/javascript" src="%s"></script>' \
     42           % urljoin(settings.ADMIN_MEDIA_PREFIX, script_path)
    3343include_admin_script = register.simple_tag(include_admin_script)
    3444
    3545def submit_row(context):
Back to Top