Ticket #9376: sneaky_initial.diff

File sneaky_initial.diff, 1.1 KB (added by aszlig, 16 years ago)
  • django/forms/fields.py

     
    442442
    443443class FileField(Field):
    444444    widget = FileInput
     445    sneaky_initial = True
    445446    default_error_messages = {
    446447        'invalid': _(u"No file was submitted. Check the encoding type on the form."),
    447448        'missing': _(u"No file was submitted."),
  • django/forms/forms.py

     
    224224            # widgets split data over several HTML fields.
    225225            value = field.widget.value_from_datadict(self.data, self.files, self.add_prefix(name))
    226226            try:
    227                 if isinstance(field, FileField):
     227                if getattr(field, 'sneaky_initial', False):
    228228                    initial = self.initial.get(name, field.initial)
    229229                    value = field.clean(value, initial)
    230230                else:
Back to Top