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