2024-08-05 22:04:15 -04:00
|
|
|
from django.apps import AppConfig
|
2024-08-05 22:08:06 -04:00
|
|
|
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,
|
|
|
|
)
|
2024-08-05 22:04:15 -04:00
|
|
|
|
|
|
|
|
|
|
|
class ReservationsConfig(AppConfig):
|
|
|
|
default_auto_field = "django.db.models.BigAutoField"
|
|
|
|
name = "reservations"
|
2024-08-05 22:08:06 -04:00
|
|
|
|
|
|
|
def ready(self):
|
|
|
|
post_migrate.connect(post_migrate_callback, sender=self)
|