from django.core.exceptions import ValidationError

def validate_image_size(image):
    max_size_mb = 2
    if image.size > max_size_mb * 1024 * 1024:
        raise ValidationError(f"Image size should not exceed {max_size_mb}MB.")

def validate_hash_tags(value):
    if value:
        tags = [tag.strip() for tag in value.split(',')]
        for tag in tags:
            if ' ' in tag:
                raise ValidationError("Hash tags should not contain spaces.")
            if not tag.startswith('#'):
                raise ValidationError("Each hash tag should start with '#' symbol.")