Skip to content

Commit

Permalink
Fail silently if an invalid code is used
Browse files Browse the repository at this point in the history
  • Loading branch information
paltman committed Jun 29, 2012
1 parent 282b8f3 commit df13671
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions waitinglist/models.py
Expand Up @@ -89,6 +89,9 @@ def handle_user_signup(sender, **kwargs):
signup_code = kwargs["form"].cleaned_data["code"]
# fetch the cohort for the signup code
qs = SignupCodeCohort.objects.select_related("cohort")
cohort = qs.get(signup_code__code=signup_code).cohort
# create a UserCohort for user association to a cohort
UserCohort.objects.create(user=kwargs["user"], cohort=cohort)
try:
cohort = qs.get(signup_code__code=signup_code).cohort
# create a UserCohort for user association to a cohort
UserCohort.objects.create(user=kwargs["user"], cohort=cohort)
except SignupCodeCohort.DoesNotExist:
pass

0 comments on commit df13671

Please sign in to comment.