Permalink
Browse files

Fail silently if an invalid code is used

  • Loading branch information...
1 parent 282b8f3 commit df136718fc80bba7837ca8bc71c29202b8924db7 @paltman paltman committed Jun 29, 2012
Showing with 6 additions and 3 deletions.
  1. +6 −3 waitinglist/models.py
View
@@ -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.