academon/core/validators.py

8 lines
No EOL
203 B
Python

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")