开发者

What are the default URLs for Django's User Authentication system?

开发者 https://www.devze.com 2023-02-09 08:31 出处:网络
Django\'s User Authentication system ( http://docs.djangoproject.com/en/dev/topics/auth/ ) is incredibly helpful in working with users. However, the documentation talks about password reset forms and

Django's User Authentication system ( http://docs.djangoproject.com/en/dev/topics/auth/ ) is incredibly helpful in working with users. However, the documentation talks about password reset forms and makes it seem like it takes care of it the same way it does user login/logout.

The default URL for login and logout is

/accounts/login/ & /accounts/logout

Are the开发者_运维知识库re already defaults for changing the password, or do I have to build that functionality?


If you look at django.contrib.auth.urls you can see the default views that are defined. That would be login, logout, password_change and password_reset.

These URLs are normally mapped to /admin/urls.py. This URLs file is provided as a convenience to those who want to deploy these URLs elsewhere. This file is also used to provide a reliable view deployment for test purposes.

So you can just hook them up in your urlconf:

url('^accounts/', include('django.contrib.auth.urls')),

As you probably want to customize those views (different form or template), in my opinion you will redefine these urls anyway. But it's a good starting point nevertheless.

0

精彩评论

暂无评论...
验证码 换一张
取 消