cmsmanage/doorcontrol/apps.py
Adam Goldsmith b6280d701f
All checks were successful
Ruff / ruff (push) Successful in 2m1s
Test / test (push) Successful in 7m20s
doorcontrol: Migrate door updater over from memberPlumbing
2024-02-23 18:39:41 -05:00

35 lines
924 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.scrapehidevents import q_getMessagesAllDoors
from .tasks.update_doors import q_update_all_doors
ensure_scheduled(
q_getMessagesAllDoors.q_task_group,
q_getMessagesAllDoors,
schedule_type=Schedule.MINUTES,
minutes=15,
)
ensure_scheduled(
"Update Door Controller Members and Cards",
q_update_all_doors,
schedule_type=Schedule.MINUTES,
minutes=15,
)
class DoorControlConfig(AppConfig):
default_auto_field = "django.db.models.BigAutoField"
name = "doorcontrol"
verbose_name = "Door Control"
def ready(self):
post_migrate.connect(post_migrate_callback, sender=self)