Source code for intranet.apps.emailfwd.management.commands.get_senior_forwards
from django.core.management.base import BaseCommand
from .....utils.date import get_senior_graduation_year
from ....emailfwd.models import SeniorEmailForward
[docs]class Command(BaseCommand):
help = "Gets all senior email forwards"
[docs] def handle(self, *args, **options):
forwards = SeniorEmailForward.objects.filter(user__graduation_year=get_senior_graduation_year(), user__user_type="student")
for forward in forwards:
self.stdout.write(f"{forward.user}:\t\t{forward.email}")