Use custom authentication backend with admin

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
"""urls.py"""
from django.conf.urls.defaults import *
from django.contrib import admin

admin.autodiscover()
admin.site.login = login_required(admin.site.login)

urlpatterns = patterns('',
    (r'^accounts/login/$', 'mycustom.auth.view'),
)

More like this

  1. Use both NTLM and Anonymous authentication with IIS by ungenio41 2 years, 10 months ago
  2. Admin Save and view next button html by ungenio41 3 years, 1 month ago
  3. Multiple User subclasses custom Auth backend by ungenio41 1 year, 9 months ago
  4. login_required decorator that doesn't redirect by brutasse 2 years, 4 months ago
  5. login_required for a generic view in URLconf by pgugged 4 years, 11 months ago

Comments

wilfred (on December 11, 2012):

Don't forget

from django.contrib.auth.decorators import login_required

#

(Forgotten your password?)