mirror of
https://github.com/bspeice/UNCCGameDay-Server
synced 2024-12-04 13:58:14 -05:00
Add code to send the RSVP email
This commit is contained in:
parent
c69bab3648
commit
b81a048ace
0
uncc_gameday/gameday/management/__init__.py
Normal file
0
uncc_gameday/gameday/management/__init__.py
Normal file
21
uncc_gameday/gameday/management/commands/send_rsvp.py
Normal file
21
uncc_gameday/gameday/management/commands/send_rsvp.py
Normal file
@ -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)
|
Loading…
Reference in New Issue
Block a user