cmsmanage/reservations/apps.py

25 lines
662 B
Python

from django.apps import AppConfig
from django.db.models.signals import post_migrate
def post_migrate_callback(sender, **kwargs):
from django_q.models import Schedule
from cmsmanage.django_q2_helper import ensure_scheduled
from .tasks.sync_google_calendar import sync_reservations_with_google_calendar
ensure_scheduled(
sync_reservations_with_google_calendar,
schedule_type=Schedule.MINUTES,
minutes=5,
)
class ReservationsConfig(AppConfig):
default_auto_field = "django.db.models.BigAutoField"
name = "reservations"
def ready(self):
post_migrate.connect(post_migrate_callback, sender=self)