Ticket #4825: widgets.diff

File widgets.diff, 755 bytes (added by Thomas Güttler <hv@…>, 8 years ago)
  • django/newforms/widgets.py

     
    7777    def render(self, name, value, attrs=None):
    7878        if value is None: value = ''
    7979        final_attrs = self.build_attrs(attrs, type=self.input_type, name=name)
    80         if value != '': final_attrs['value'] = force_unicode(value) # Only add the 'value' attribute if a value is non-empty.
     80        if value != '' and self.input_type!="file":
     81            final_attrs['value'] = force_unicode(value) # Only add the 'value' attribute if a value is non-empty.
    8182        return u'<input%s />' % flatatt(final_attrs)
    8283
    8384class TextInput(Input):
Back to Top