I have a user model with my own authentication. But despite this, I cannot log in to the Django admin. A page will appear, but it does not accept my credentials (which are correct). I included django.contrib.auth.backends.ModelBackend
along with my own authentication database in AUTHENTICATION_BACKENDS
. The parameters is_staff
and is_admin
are set when checking the shell.
Am I missing something obvious?
AUTHENTICATION_BACKENDS = ( 'django.contrib.auth.backends.ModelBackend', 'final.backends.CustomBackend',) AUTH_USER_MODEL = 'final.MyUser' MIDDLEWARE_CLASSES = ( 'django.middleware.common.CommonMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', # Uncomment the next line for simple clickjacking protection: # 'django.middleware.clickjacking.XFrameOptionsMiddleware', ) INSTALLED_APPS = ( 'rest_framework.authtoken', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.sites', 'django.contrib.messages', 'django.contrib.staticfiles', # Uncomment the next line to enable the admin: 'django.contrib.admin', # Uncomment the next line to enable admin documentation: 'final', 'rest_framework', ) REST_FRAMEWORK = { 'DEFAULT_AUTHENTICATION_CLASSES': ( 'final.authentication.ExpiringTokenAuthentication', ) }
Ignore the poor grooves, please. They got lost as a result of massacres with a copy.
source share