How to use django
i am making a dajnago 1.8 application (using python3), but i want that the admin users (is_staff = True) can loggin through a ldap server and the admin superusers (is_superuser = True) can logged in using the default django auth. I am using django_python3_ldap for ldap loggin backend, and the django admin site for administaration. Now, the application seems that allways auth users through ldap backend and don't use the default authentication backend, and i want too if the connection to ldap server fails use only the default authentication backend. To do that i need create my own admin site or i can apply some configuration for this purpose. Thanks.
Have you set up your authentication backends like this?
AUTHENTICATION_BACKENDS = (
'django.contrib.auth.backends.ModelBackend',
'django_python3_ldap.auth.LDAPBackend',
)
That should try both for the given credentials. If it succeeds on the ModelBackend, it will not attempt to try LDAP. It goes through them sequentially until it find one that works.
链接地址: http://www.djcxy.com/p/33698.html上一篇: 蟒蛇
下一篇: 如何使用django