Ticket #6302: newforms-admin_filefield_initial_fix.diff
File newforms-admin_filefield_initial_fix.diff, 956 bytes (added by , 17 years ago) |
---|
-
django/newforms/fields.py
433 433 'missing': _(u"No file was submitted."), 434 434 'empty': _(u"The submitted file is empty."), 435 435 } 436 _initial = None 436 437 437 438 def __init__(self, *args, **kwargs): 438 439 super(FileField, self).__init__(*args, **kwargs) … … 451 452 raise ValidationError(self.error_messages['empty']) 452 453 return f 453 454 455 def _get_initial(self): 456 return self._initial 457 458 def _set_initial(self, initial): 459 self.required = False 460 self._initial = initial 461 462 initial = property(_get_initial, _set_initial) 463 454 464 class ImageField(FileField): 455 465 default_error_messages = { 456 466 'invalid_image': _(u"Upload a valid image. The file you uploaded was either not an image or a corrupted image."),