def request_link(request): signup = None try: signup = signup_api.get_signup(request.POST.get('email')) messages.success(request, 'Check your inbox -- a tasty new link will be there shortly.') send_user_link(signup['email'], signup['key']) except: messages.error(request, 'Not so fast, partner -- you need to sign up for the Mechanical MOOC first!') url = reverse('classphoto_sequence_redirect') if settings.DEBUG and signup: url += '?key={0}'.format(signup['key']) return http.HttpResponseRedirect(url)
def request_link(request): signup = None try: signups = signup_api.get_all_user_signups(request.POST.get('email')) if len(signups) == 0: raise Exception() signup = signups[0] messages.success(request, 'Check your inbox -- a tasty new link will be there shortly.') send_user_link(signup['email'], signup['key']) # TODO user will receive an error if they request a link and they only signed up for a previous sequence :( except: messages.error(request, 'Not so fast, partner -- you need to sign up for the Mechanical MOOC first!') url = reverse('classphoto_sequence_redirect') if settings.DEBUG and signup: url += '?key={0}'.format(signup['key']) return http.HttpResponseRedirect(url)
def request_link(request): signup = None try: signups = signup_api.get_all_user_signups(request.POST.get('email')) if len(signups) == 0: raise Exception() signup = signups[0] messages.success( request, 'Check your inbox -- a tasty new link will be there shortly.') send_user_link(signup['email'], signup['key']) # TODO user will receive an error if they request a link and they only signed up for a previous sequence :( except: messages.error( request, 'Not so fast, partner -- you need to sign up for the Mechanical MOOC first!' ) url = reverse('classphoto_sequence_redirect') if settings.DEBUG and signup: url += '?key={0}'.format(signup['key']) return http.HttpResponseRedirect(url)