使用示例
1.创建用户
>>> from django.contrib.auth.models import User
>>> user = User.objects.create_user('john', 'lennon@thebeatles.com', 'johnpassword')
# At this point, user is a User object that has already been saved
# to the database. You can continue to change its attributes
# if you want to change other fields.
>>> user.is_staff = True
>>> user.save()
2.修改密码
>>> from django.contrib.auth.models import User
>>> u = User.objects.get(username__exact='john')
>>> u.set_password('new password')
>>> u.save()
创建超级管理员
manage.py createsuperuser --username=joe --email=joe@example.com

前端效果:

参考资料:

Django中的Users权限系统:http://blog.chinaunix.net/uid-25525723-id-331051.html

自己做的修改密码页面,自动弹出不需要的东西 :http://mozilla.com.cn/thread-329027-1-1.html

最新文章

  1. HAProxy的日志配置以及ACL规则实现负载均衡
  2. [tem]树状数组
  3. Form 详细属性--2016年12月4日
  4. python 自带的ide 不能保存文件
  5. mybatis - resultMap
  6. Atitit 电子商务订单号码算法(java c# php js 微信
  7. 百度地图的简单使用 ——html js
  8. 如何设置启动页 LaunchImage
  9. Oracle GoldenGate 12c实时捕获SQL Server数据
  10. segment fault
  11. 51单片机连接24C02-C语言测试代码
  12. Springmvc整合mybatis
  13. 微信开放平台 获取 component_verify_ticket
  14. .NEL IL实现对象深拷贝
  15. java中volatile的简单理解
  16. Log4j使用笔记:每天生成一个日志文件、按日志大小生成文件
  17. docker基础学习(一)
  18. SpringSecurity认证处理流程
  19. PHP http_build_query()方法
  20. Search for a Range leetcode java

热门文章

  1. ref:ThinkPHP Builder.php SQL注入漏洞(<= 3.2.3)
  2. Java常用工具类之MD5加密
  3. Centos7 安装单节点Torque PBS
  4. shell中的cat和文件分界符(<<EOF) (转)
  5. 【BZOJ 3106】 3106: [cqoi2013]棋盘游戏 (对抗搜索)
  6. 【BZOJ 2728】 2728: [HNOI2012]与非 (线性基?)
  7. [BOI2004]Sequence
  8. 2018 计算之道初赛第二场 阿里巴巴的手机代理商(困难)(反向可持久化Trie)
  9. 修改选择排序 Exercise07_20
  10. bzoj 1211: [HNOI2004]树的计数 -- purfer序列