new_form.py 文件源码

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

项目:web 作者: pyjobs 项目源码 文件源码
def _validate_python(self, value, state=None):
        if len(value) > self.max_length:
            raise ValidationError('toolong', self)

        name_slug = slugify(value)

        # Check for duplicates in the database
        try:
            CompanyAlchemy.get_company(name_slug)
        except NoResultFound:
            # There are no duplicates, the validation is therefore successful
            pass
        else:
            # This company slug name is already present in the database, notify
            # the user that the company he's trying to register already exists.
            raise ValidationError('already_exists', self)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号