from django.contrib.auth.models import User
user = User.objects.get(email="anyone@anymail.com")
user.set_password('new_password')
user.save() # call save explicitly
根据文件
set_password(raw_password)
Sets the user’s password to the given raw
string, taking care of the password hashing. Doesn’t save the User
object.
您不需要登录用户来更改密码。您可以使用Django的^{} 助手函数来更改密码。在
根据文件
相关问题 更多 >
编程相关推荐