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}'))