Skip to content
This repository was archived by the owner on May 16, 2020. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion hacknight/models/participant.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from hacknight.models.user import User
from hacknight.models.event import Event

__all__ = ['Participant', 'PARTICIPANT_STATUS']
__all__ = ['Participant', 'PARTICIPANT_STATUS', 'participant_status']


class PARTICIPANT_STATUS:
Expand All @@ -14,6 +14,14 @@ class PARTICIPANT_STATUS:
REJECTED = 3
WITHDRAWN = 4

participant_status = {
PARTICIPANT_STATUS.PENDING: "participation is pending",
PARTICIPANT_STATUS.WL: "participation is waitlisted",
PARTICIPANT_STATUS.CONFIRMED: "participation is confirmed",
PARTICIPANT_STATUS.REJECTED: "participation is rejected",
PARTICIPANT_STATUS.WITHDRAWN: "participation is withdrawn",
}


class Participant(BaseMixin, db.Model):
__tablename__ = 'participant'
Expand Down
4 changes: 2 additions & 2 deletions hacknight/views/event.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from coaster.views import load_model, load_models
from baseframe.forms import render_redirect, render_form, render_delete_sqla
from hacknight import app, mail
from hacknight.models import db, Profile, Event, User, Participant, PARTICIPANT_STATUS, EventRedirect
from hacknight.models import db, Profile, Event, User, Participant, PARTICIPANT_STATUS, EventRedirect, participant_status
from hacknight.forms.event import EventForm, ConfirmWithdrawForm, SendEmailForm, EmailEventParticipantsForm
from hacknight.forms.participant import ParticipantForm
from hacknight.views.login import lastuser
Expand Down Expand Up @@ -172,7 +172,7 @@ def event_update_participant_status(profile, event):
message = message.replace("*|FULLNAME|*", participant.user.fullname)
if message and g.user.email:
send_email(sender=(g.user.fullname, g.user.email), to=participant.email,
subject="%s - Hacknight participation status" % event.title , body=text_message, html=message)
subject="%s %s" % (event.title, participant_status.get(participant.status)), body=text_message, html=message)
except KeyError:
pass
db.session.commit()
Expand Down