Code

Ticket #6750: 6750.diff

File 6750.diff, 829 bytes (added by garcia_marc, 6 years ago)

Patch for the ticket (without a dictionary as string variables)

Line 
1Index: django/contrib/admin/widgets.py
2===================================================================
3--- django/contrib/admin/widgets.py     (revision 7212)
4+++ django/contrib/admin/widgets.py     (working copy)
5@@ -72,8 +72,8 @@
6         from django.conf import settings
7         output = []
8         if value:
9-            output.append('%s <a target="_blank" href="%s%s">%s</a> <br />%s ' % \
10-                (_('Currently:'), settings.MEDIA_URL, value, value, _('Change:')))
11+            output.append('%s <a href="%s%s" onclick="window.open(\'%s%s\'); return false">%s</a> <br />%s ' % \
12+                (_('Currently:'), settings.MEDIA_URL, value, settings.MEDIA_URL, value, value, _('Change:')))
13         output.append(super(AdminFileWidget, self).render(name, value, attrs))
14         return mark_safe(u''.join(output))
15