Use on forms of your app.
1 2 3 4 5 6 7 8 | class MyFileInput(forms.FileInput):
def render(self,name, value, attrs=None):
output = []
if value and hasattr(value, "url"):
output.append('%s <a target="_blank" href="%s">%s</a> <br />%s ' % \
(_('Actual:'), value.url, value, _('Cambio:')))
output.append(super(MyFileInput, self).render(name, value, attrs))
return mark_safe(u''.join(output))
|
More like this
- csrf test by zukosdead 3 days, 21 hours ago
- find even number by Rajeev529 8 months, 2 weeks ago
- Form field with fixed value by roam 9 months, 1 week ago
- New Snippet! by Antoliny0919 9 months, 2 weeks ago
- Add Toggle Switch Widget to Django Forms by OgliariNatan 1 year ago
Comments
Django 1.3 has already this feature.
#
Please login first before commenting.