Ticket #5695: 5695.diff
File 5695.diff, 1.4 KB (added by , 17 years ago) |
---|
-
django/contrib/admin/widgets.py
72 72 from django.conf import settings 73 73 output = [] 74 74 if value: 75 output.append(' Currently: <a target="_blank" href="%s%s">%s</a> <br>Change: ' % (settings.MEDIA_URL, value, value))75 output.append('%s: <a onclick="window.open(\'%s%s\'); return false" href="%s%s">%s</a><br/>%s: ' % (_('Currently'), settings.MEDIA_URL, value, settings.MEDIA_URL, value, value, _('Change'))) 76 76 output.append(super(AdminFileWidget, self).render(name, value, attrs)) 77 77 return mark_safe(u''.join(output)) 78 78 -
dev/null
1 >>> from django.contrib.admin.widgets import AdminFileWidget 2 >>> w = AdminFileWidget() 3 >>> w.render('filename', '') 4 u'<input type="file" name="filename" />' 5 >>> w.render('filename', None) 6 u'<input type="file" name="filename" />' 7 >>> w.render('filename', '/media/file.ext') 8 u'Currently: <a onclick="window.open(\'//media/file.ext\'); return false" href="//media/file.ext">/media/file.ext</a><br/>Change: <input type="file" name="filename" />'