没有用户在Django 1.3中进行身份验证,可以使用Admin UI吗? [英] Can the Admin UI be used without the user authenticating in Django 1.3?
本文介绍了没有用户在Django 1.3中进行身份验证,可以使用Admin UI吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想知道是否有一个简单的方法来配置Django Admin UI(例如: http://mysite.com/管理员),以便我不需要验证/登录?
I was wondering if there's an easy way to configure the Django Admin UI (eg at http://mysite.com/admin) so that I don't need to authenticate/login?
我已经尝试调整urls.py,但无法让它绕过登录屏幕:
I've tried tweaking urls.py but couldn't get it to bypass the login screen:
urlpatterns = patterns('',
url(r'^admin/', include(admin.site.urls)),
)
我想去 http://mysite.com/admin ,无需登录即可查看django对象列表。
I'd like to go to http://mysite.com/admin and see the list of django objects without having to login.
谢谢。
推荐答案
- Django管理框架使用' code> is_staff '标记在'
用户
'对象上,以验证使用管理站点的权限。 - 所以需要一个用户进行身份验证,以验证他的管理员相关权限。
- 如果要禁用此功能,则必须覆盖管理站点的索引方法。
- 可在
django.contrib.admin.sites
下载。 - Django admin framework uses '
is_staff
' flag on the 'User
' object to verify the permission to use admin site. - So it needs an user to be authenticated to verify his admin related permissions.
- If you want to disable this, you have to override the 'index' method of the admin site.
- It is available at
django.contrib.admin.sites
.
def index(self,request,extra_context = None):
"""
Displays the main admin index page, which lists all of the installed
apps that have been registered in this site.
"""
这篇关于没有用户在Django 1.3中进行身份验证,可以使用Admin UI吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文