Ticket #9376: sneaky_initial.diff
File sneaky_initial.diff, 1.1 KB (added by , 16 years ago) |
---|
-
django/forms/fields.py
442 442 443 443 class FileField(Field): 444 444 widget = FileInput 445 sneaky_initial = True 445 446 default_error_messages = { 446 447 'invalid': _(u"No file was submitted. Check the encoding type on the form."), 447 448 'missing': _(u"No file was submitted."), -
django/forms/forms.py
224 224 # widgets split data over several HTML fields. 225 225 value = field.widget.value_from_datadict(self.data, self.files, self.add_prefix(name)) 226 226 try: 227 if isinstance(field, FileField):227 if getattr(field, 'sneaky_initial', False): 228 228 initial = self.initial.get(name, field.initial) 229 229 value = field.clean(value, initial) 230 230 else: