def username_reminder(request): if request.user.is_authenticated(): return HttpResponseRedirect(reverse("accounts-home")) if request.method == "POST": form = UsernameReminderForm(request.POST) if form.is_valid(): user = form.cleaned_data["user"] send_mail_template(u'username reminder.', 'accounts/email_username_reminder.txt', dict(user=user), None, user.email) return render_to_response('accounts/username_reminder.html', dict(form=form, sent=True), context_instance=RequestContext(request)) else: form = UsernameReminderForm() return render_to_response('accounts/username_reminder.html', dict(form=form, sent=False), context_instance=RequestContext(request))
def username_reminder(request): if request.user.is_authenticated(): return HttpResponseRedirect(reverse('accounts-home')) if request.method == 'POST': form = UsernameReminderForm(request.POST) if form.is_valid(): user = form.cleaned_data['user'] send_mail_template(u'username reminder.', 'accounts/email_username_reminder.txt', {'user': user}, None, user.email) return render(request, 'accounts/username_reminder.html', {'form': form, 'sent': True}) else: form = UsernameReminderForm() return render(request, 'accounts/username_reminder.html', {'form': form, 'sent': False})
def username_reminder(request): if request.user.is_authenticated(): return HttpResponseRedirect(reverse("accounts-home")) if request.method == "POST": form = UsernameReminderForm(request.POST) if form.is_valid(): user = form.cleaned_data["user"] send_mail_template( u"username reminder.", "accounts/email_username_reminder.txt", {"user": user}, None, user.email ) return render(request, "accounts/username_reminder.html", {"form": form, "sent": True}) else: form = UsernameReminderForm() return render(request, "accounts/username_reminder.html", {"form": form, "sent": False})