cmsmanage/tasks/management/commands/sendNotifications.py
Adam Goldsmith 9ec48f075f Initial Commit
basic web-app functionality works
2020-12-03 12:31:39 -05:00

21 lines
698 B
Python

import smtplib
from email.message import EmailMessage
from django.core.management.base import BaseCommand, CommandError
from tasks.models import Tool, Task, Event
class Command(BaseCommand):
help = 'Sends any notifications for upcoming and overdue tasks'
# TODO: actually send notifications
def handle(self, *args, **options):
for tool in Tool.objects.all():
print(tool.name)
for task in tool.task_set.all():
print('==>', task.name, 'next:', task.next_recurrence())
if task.is_overdue():
self.stdout.write(self.style.SUCCESS(
f'Sending Notification for task {task.name}'))