Ticket #8275: 8275.unused_imports.diff

File 8275.unused_imports.diff, 2.4 KB (added by Julien Phalip, 10 years ago)
  • django/django/contrib/auth/views.py

    22from django.contrib.auth import REDIRECT_FIELD_NAME
    33from django.contrib.auth.decorators import login_required
    44from django.contrib.auth.forms import AuthenticationForm
    5 from django.contrib.auth.forms import PasswordResetForm, SetPasswordForm, PasswordChangeForm, AdminPasswordChangeForm
     5from django.contrib.auth.forms import PasswordResetForm, SetPasswordForm, PasswordChangeForm
    66from django.contrib.auth.tokens import default_token_generator
    7 from django.core.exceptions import PermissionDenied
    87from django.core.urlresolvers import reverse
    98from django.shortcuts import render_to_response, get_object_or_404
    109from django.contrib.sites.models import Site, RequestSite
    1110from django.http import HttpResponseRedirect, Http404
    1211from django.template import RequestContext
    1312from django.utils.http import urlquote, base36_to_int
    14 from django.utils.html import escape
    1513from django.utils.translation import ugettext as _
    1614from django.contrib.auth.models import User
    17 import re
    1916def login(request, template_name='registration/login.html', redirect_field_name=REDIRECT_FIELD_NAME):
    2017    "Displays the login form and handles the login action."
    2421        if form.is_valid():
    2522            # Light security check -- make sure redirect_to isn't garbage.
    2623            if not redirect_to or '//' in redirect_to or ' ' in redirect_to:
    27                 from django.conf import settings
    2824                redirect_to = settings.LOGIN_REDIRECT_URL
    2925            from django.contrib.auth import login
    3026            login(request, form.get_user())
    5753def logout_then_login(request, login_url=None):
    5854    "Logs out the user if he is logged in. Then redirects to the log-in page."
    5955    if not login_url:
    60         from django.conf import settings
    6156        login_url = settings.LOGIN_URL
    6257    return logout(request, login_url)
    6459def redirect_to_login(next, login_url=None, redirect_field_name=REDIRECT_FIELD_NAME):
    6560    "Redirects the user to the login page, passing the given 'next' page"
    6661    if not login_url:
    67         from django.conf import settings
    6862        login_url = settings.LOGIN_URL
    6963    return HttpResponseRedirect('%s?%s=%s' % (login_url, urlquote(redirect_field_name), urlquote(next)))
Back to Top