def clean(self): cleaned_data = super(AddNewsFileForm, self).clean() news_file = cleaned_data.get('file') if news_file: if news_file._size > get_max_size(): raise ValidationError('File is too large ( > %s MB )' % get_max_size_in_mb()) else: raise ValidationError('File field must not be empty.') return cleaned_data
def clean(self): cleaned_data = super(AddPageFileForm, self).clean() file = cleaned_data.get("file") if file: if file._size > get_max_size(): raise ValidationError("File is too large ( > %s MB )" % get_max_size_in_mb()) else: raise ValidationError("File field must not be empty.") return cleaned_data
def clean(self): cleaned_data = super(AddNewsImageForm, self).clean() image = cleaned_data.get('image') if image: if image._size > get_max_size(): raise ValidationError('Image is too large ( > %s MB )' % get_max_size_in_mb()) else: raise ValidationError('Image field must not be empty.') return cleaned_data