Skip to content
Snippets Groups Projects

Notify sponsors about ending roles

Merged Andreas Ellewsen requested to merge GREG-162-notify-role-ending into master
Files
8
+ 31
0
"""
Command for scheduling the django-q task for notifying sponsors of
expiring roles.
Instead of having a task that gets scheduled, we could have had a
management command that was run as a cronjob. However, that would mean
another cronjob
"""
import logging
import logging.config
from django.conf import settings
from django.core.management.base import BaseCommand
from django_q.tasks import schedule
logging.config.dictConfig(settings.LOGGING)
logger = logging.getLogger(__name__)
class Command(BaseCommand):
help = "Schedule notification of sponsors"
def handle(self, *args, **options):
logger.info("Scheduling role end notifier task...")
schedule(
func="tasks.notify_sponsors_roles_ending",
schedule_type=settings.NOTIFIER_SCHEDULE_TYPE,
)
logger.info("Role end notifier task scheduled.")
Loading