diff -urN Django-0.95.1/django/contrib/admin/templatetags/admin_list.py Django-0.95.1-hb/django/contrib/admin/templatetags/admin_list.py
old
|
new
|
|
9 | 9 | from django.utils.translation import get_date_formats, get_partial_date_formats |
10 | 10 | from django.template import Library |
11 | 11 | import datetime |
| 12 | from urlparse import urljoin |
12 | 13 | |
13 | 14 | register = Library() |
14 | 15 | |
… |
… |
|
148 | 149 | # Booleans are special: We use images. |
149 | 150 | elif isinstance(f, models.BooleanField) or isinstance(f, models.NullBooleanField): |
150 | 151 | BOOLEAN_MAPPING = {True: 'yes', False: 'no', None: 'unknown'} |
151 | | result_repr = '<img src="%simg/admin/icon-%s.gif" alt="%s" />' % (settings.ADMIN_MEDIA_PREFIX, BOOLEAN_MAPPING[field_val], field_val) |
| 152 | result_repr = '<img src="%simg/admin/icon-%s.gif" alt="%s" />' % (urljoin(settings.MEDIA_URL, settings.ADMIN_MEDIA_PREFIX), BOOLEAN_MAPPING[field_val], field_val) |
152 | 153 | # FloatFields are special: Zero-pad the decimals. |
153 | 154 | elif isinstance(f, models.FloatField): |
154 | 155 | if field_val is not None: |
diff -urN Django-0.95.1/django/contrib/admin/templatetags/admin_modify.py Django-0.95.1-hb/django/contrib/admin/templatetags/admin_modify.py
old
|
new
|
|
7 | 7 | from django.db.models.related import BoundRelatedObject |
8 | 8 | from django.conf import settings |
9 | 9 | import re |
| 10 | from urlparse import urljoin |
10 | 11 | |
11 | 12 | register = template.Library() |
12 | 13 | |
… |
… |
|
29 | 30 | <script type="text/javascript" src="/media/admin/js/calendar.js"> |
30 | 31 | """ |
31 | 32 | |
32 | | return '<script type="text/javascript" src="%s%s"></script>' % (settings.ADMIN_MEDIA_PREFIX, script_path) |
| 33 | return '<script type="text/javascript" src="%s%s"></script>' % (urljoin(settings.MEDIA_URL, settings.ADMIN_MEDIA_PREFIX), script_path) |
33 | 34 | include_admin_script = register.simple_tag(include_admin_script) |
34 | 35 | |
35 | 36 | def submit_row(context): |
… |
… |
|
196 | 197 | if f.rel and isinstance(f.rel, models.ManyToManyRel) and f.rel.filter_interface: |
197 | 198 | return '<script type="text/javascript">addEvent(window, "load", function(e) {' \ |
198 | 199 | ' SelectFilter.init("id_%s", "%s", %s, "%s"); });</script>\n' % ( |
199 | | f.name, f.verbose_name, f.rel.filter_interface-1, settings.ADMIN_MEDIA_PREFIX) |
| 200 | f.name, f.verbose_name, f.rel.filter_interface-1, urljoin(settings.MEDIA_URL, settings.ADMIN_MEDIA_PREFIX)) |
200 | 201 | else: |
201 | 202 | return '' |
202 | 203 | filter_interface_script_maybe = register.simple_tag(filter_interface_script_maybe) |
diff -urN Django-0.95.1/django/contrib/admin/templatetags/adminmedia.py Django-0.95.1-hb/django/contrib/admin/templatetags/adminmedia.py
old
|
new
|
|
1 | 1 | from django.template import Library |
| 2 | from urlparse import urljoin |
2 | 3 | |
3 | 4 | register = Library() |
4 | 5 | |
5 | 6 | def admin_media_prefix(): |
6 | 7 | """ |
7 | | Returns the string contained in the setting ADMIN_MEDIA_PREFIX. |
| 8 | Returns the string contained in the settings MEDIA_URL and ADMIN_MEDIA_PREFIX. |
8 | 9 | """ |
9 | 10 | try: |
10 | 11 | from django.conf import settings |
11 | 12 | except ImportError: |
12 | 13 | return '' |
13 | | return settings.ADMIN_MEDIA_PREFIX |
| 14 | return urljoin(settings.MEDIA_URL, settings.ADMIN_MEDIA_PREFIX) |
14 | 15 | admin_media_prefix = register.simple_tag(admin_media_prefix) |