1
0
mirror of https://github.com/django/django.git synced 2025-07-05 02:09:13 +00:00

newforms-admin: Fixed #5695. AdminFileWidget now properly marks strings for translation and a minor XHTML fix.

git-svn-id: http://code.djangoproject.com/svn/django/branches/newforms-admin@7212 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Brian Rosner 2008-03-10 18:08:30 +00:00
parent ac4f5efc4f
commit 9d4db678f4
2 changed files with 3 additions and 2 deletions

View File

@ -28,7 +28,7 @@ HTML escaped.
>>> w = AdminFileWidget() >>> w = AdminFileWidget()
>>> print conditional_escape(w.render('test', 'test')) >>> print conditional_escape(w.render('test', 'test'))
Currently: <a target="_blank" href="%(MEDIA_URL)stest">test</a> <br>Change: <input type="file" name="test" /> Currently: <a target="_blank" href="%(MEDIA_URL)stest">test</a> <br />Change: <input type="file" name="test" />
To test ForeignKeyRawIdWidget a user object must be created. Its pk is To test ForeignKeyRawIdWidget a user object must be created. Its pk is
explicitly set to 100 to avoid having to potentially overmatch in the test. explicitly set to 100 to avoid having to potentially overmatch in the test.

View File

@ -72,7 +72,8 @@ class AdminFileWidget(forms.FileInput):
from django.conf import settings from django.conf import settings
output = [] output = []
if value: if value:
output.append('Currently: <a target="_blank" href="%s%s">%s</a> <br>Change: ' % (settings.MEDIA_URL, value, value)) output.append('%s <a target="_blank" href="%s%s">%s</a> <br />%s ' % \
(_('Currently:'), settings.MEDIA_URL, value, value, _('Change:')))
output.append(super(AdminFileWidget, self).render(name, value, attrs)) output.append(super(AdminFileWidget, self).render(name, value, attrs))
return mark_safe(u''.join(output)) return mark_safe(u''.join(output))