"""Locations signals"""

# Django
from django.db.models.signals import post_save, post_delete
from django.dispatch import receiver

# Models
from {{project_slug}}.locations.models import State

# Clear cache
from {{project_slug}}.utils.cache_utils import clear_cache


@receiver(post_save, sender=State)
def state_update(sender, instance: State, created, **kwargs):
    clear_cache("states")


@receiver(post_delete, sender=State)
def state_delete(sender, instance: State, **kwargs):
    clear_cache("states")
