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.')
)
评论列表
文章目录