validators.py 文件源码

python
阅读 21 收藏 0 点赞 0 评论 0

项目:django-validator 作者: romain-li 项目源码 文件源码
def is_valid(self, value, params):
        if isinstance(value, basestring):
            self.message = _('The {{key}} may not be greater than {max} characters.').format(max=self.max_value)
            return len(value) <= self.max_value
        elif isinstance(value, File):
            self.message = _('The {{key}} must not be at greater {max} bytes.'.format(max=self.max_value))
            return value.size <= self.max_value
        else:
            self.message = _('The {{key}} may not be greater than {max}.').format(max=self.max_value)
            return value <= self.max_value
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号