from django.contrib.auth.hashers import make_password, check_password
#生成密码:
>>> text = "www.111cn.net"
>>> passwd = make_password(text, None, 'pbkdf2_sha256')
>>> print passwd
pbkdf2_sha256$12000$xzMLhCNvQbb8$i1XDnJIpb/cRRGRX2x7Ym74RNfPRCUp5pbU6Sn+V3J0=
#验证密码:
>>> print check_password(text, passwd)
True
#导入django的messages模块
from django.contrib import messages
#成功消息
self.message_user(request,'修改成功!')
#失败消息
messages.add_message(request, messages.ERROR, '出错了')
#用于显示ForeignKey or ManyToManyField 的ID和一个查询修改它们的接口
raw_id_fields = ["fields"]