示例#1
0
文件: forms.py 项目: ramuta/kindy-old
    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
示例#2
0
文件: forms.py 项目: ramuta/kindy-old
    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
示例#3
0
文件: forms.py 项目: ramuta/kindy-old
    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