Home Python Django修改密码的办法(通过console)
Post
Cancel

Python Django修改密码的办法(通过console)

跟Rails很接近。

$ python manage.py shell

然后:
from django.contrib.auth.models import User  (这里的User 哪怕跟你的表名字不同,也没关系,也叫User...估计跟项目配置相关)
u = User.objects.get(username__exact='john')    
u.set_password('new password')
u.save()
This post is licensed under CC BY 4.0 by the author.