models.py 文件源码

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

项目:imagery 作者: cenima-ibama 项目源码 文件源码
def validate_scene_name(value):
    """Validator for the scene_name field of PastSceneDownload Model."""
    try:
        Scene.objects.get(name=value)
        raise ValidationError(
            _('The scene you want is already on our database.')
            )
    except Scene.DoesNotExist:
        if len(value) != 21:
            raise ValidationError(
                _('The scene name needs to have 21 characters.')
            )
        elif not value.startswith('L') or value[2] not in ['5', '7', '8']:
            raise ValidationError(
                _('Wrong scene name. Please check it.')
            )
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号