django---authenticate

来源:互联网 发布:数据治理定义 编辑:程序博客网 时间:2024/06/18 03:58

一、定制authentication

二、包括两个方面authentication验证 和authorization授权

三、默认的四个参数:username,password,email,first name,last name

四、创建users

User.objects.create_user(username,.....)

五、创建超级用户

python manage.py createsuperuser --username=joe --email=joe@example.com

六、更改用户的密码
manage.py changpassword *username*

user=User.object.get(username='')

user.set_password('new password')

u.save()

七、login(request,user)。如果不是指定默认的next,则将使用settings.LOGIN_REDIRECT_URL,这个设置的默认值为/accounts/profile/