Slightly reworked imports in contrib.auth.__init__

This commit is contained in:
Claude Paroz 2013-05-18 16:01:47 +02:00
parent dc43fbc2f2
commit 710c59bf9b
1 changed files with 4 additions and 5 deletions

View File

@ -1,9 +1,11 @@
import re
from django.contrib.auth.signals import user_logged_in, user_logged_out, user_login_failed
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured, PermissionDenied
from django.utils.module_loading import import_by_path
from .signals import user_logged_in, user_logged_out, user_login_failed
SESSION_KEY = '_auth_user_id'
BACKEND_SESSION_KEY = '_auth_user_backend'
REDIRECT_FIELD_NAME = 'next'
@ -14,7 +16,6 @@ def load_backend(path):
def get_backends():
from django.conf import settings
backends = []
for backend_path in settings.AUTHENTICATION_BACKENDS:
backends.append(load_backend(backend_path))
@ -106,7 +107,6 @@ def logout(request):
def get_user_model():
"Return the User model that is active in this project"
from django.conf import settings
from django.db.models import get_model
try:
@ -120,8 +120,7 @@ def get_user_model():
def get_user(request):
from django.conf import settings
from django.contrib.auth.models import AnonymousUser
from .models import AnonymousUser
try:
user_id = request.session[SESSION_KEY]
backend_path = request.session[BACKEND_SESSION_KEY]