diff --git a/uncc_gameday/gameday/management/__init__.py b/uncc_gameday/gameday/management/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/uncc_gameday/gameday/management/commands/__init__.py b/uncc_gameday/gameday/management/commands/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/uncc_gameday/gameday/management/commands/send_rsvp.py b/uncc_gameday/gameday/management/commands/send_rsvp.py new file mode 100644 index 0000000..833c4b0 --- /dev/null +++ b/uncc_gameday/gameday/management/commands/send_rsvp.py @@ -0,0 +1,21 @@ +from datetime import datetime, timedelta + +from django.core.management.base import BaseCommand +from django.core.mail import send_mail +from gameday.models import RegisteredUser + +class Command(BaseCommand): + + def handle(self, *args, **kwargs): + subject = 'Students who RSVP\'ed to the game on %s:' %\ + datetime.today().date() + from_ = 'rsvp@uncc-gameday.no-ip.org' + recipient_list = ['bspeice.nc@gmail.com'] + + message = 'The following people have registered as attending the game:\n\n' + + for user in RegisteredUser.objects.filter(date_registered__gt= + (datetime.today() - timedelta(7))): + message += user.first_name + ' ' + user.last_name + '\n' + + send_mail(subject, message, from_,recipient_list)