academon/core/validators.py

8 lines
203 B
Python
Raw Normal View History

from django.core.exceptions import ValidationError
from pathlib import Path
def validate_directory(value):
if not Path(value).is_dir():
raise ValidationError(f"{value} is not a directory")