Mercurial > public > sg101
changeset 783:004b3a90de66
Update our code that expected LOGIN_REDIRECT_URL to be a url.
It is now a view name.
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Tue, 13 May 2014 20:23:30 -0500 |
parents | 9133b4626a4b |
children | b554aedf45df aa7c97d93a85 |
files | accounts/views.py |
diffstat | 1 files changed, 7 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/accounts/views.py Tue May 13 19:44:48 2014 -0500 +++ b/accounts/views.py Tue May 13 20:23:30 2014 -0500 @@ -4,9 +4,7 @@ """ import logging -from django.shortcuts import render -from django.http import HttpResponseRedirect -from django.core.urlresolvers import reverse +from django.shortcuts import render, redirect from django.conf import settings from accounts.models import PendingUser @@ -22,13 +20,13 @@ @log_auth_failures('Register') def register(request): if request.user.is_authenticated(): - return HttpResponseRedirect(settings.LOGIN_REDIRECT_URL) + return redirect(settings.LOGIN_REDIRECT_URL) if request.method == 'POST': form = RegisterForm(request.POST, ip=request.META.get('REMOTE_ADDR', '?')) if form.is_valid(): form.save() - return HttpResponseRedirect(reverse('accounts.views.register_thanks')) + return redirect('accounts.views.register_thanks') else: form = RegisterForm() @@ -38,7 +36,7 @@ def register_thanks(request): if request.user.is_authenticated(): - return HttpResponseRedirect(settings.LOGIN_REDIRECT_URL) + return redirect(settings.LOGIN_REDIRECT_URL) return render(request, 'accounts/register_thanks.html') @@ -46,7 +44,7 @@ def register_confirm(request, username, key): if request.user.is_authenticated(): - return HttpResponseRedirect(settings.LOGIN_REDIRECT_URL) + return redirect(settings.LOGIN_REDIRECT_URL) # purge expired users @@ -78,13 +76,13 @@ def username_query(request): """This view handles forgotten username queries.""" if request.user.is_authenticated(): - return HttpResponseRedirect(settings.LOGIN_REDIRECT_URL) + return redirect(settings.LOGIN_REDIRECT_URL) if request.method == 'POST': form = ForgotUsernameForm(data=request.POST) if form.is_valid(): form.save() - return HttpResponseRedirect(reverse('accounts-username_sent')) + return redirect('accounts-username_sent') else: form = ForgotUsernameForm()