AES 使用 djangosnippets 中的片段加密 django 中的密码字段
我正在尝试使用此代码段: http://www.djangosnippets.org/snippets/1095/< /a> 在我正在构建的模型上 - 我将其定义为:
first = models.TextField()
last = models.TextField()
email = models.EmailField(default=None)
screen = models.TextField()
password = models.EncryptedCharField()
icon = models.ImageField(upload_to='avatars/')
当我尝试验证模型(运行syncdb)时,它给我一个错误,指出“EncryptedCharField”未定义。
我的 model.py 文件中存在该片段的代码 - 这是不正确的吗?我是否需要在其他地方实现这个片段,或者让它扩展一个不同的类?
I am attempting to use this snippet: http://www.djangosnippets.org/snippets/1095/ on a model I am building- I am defining things as:
first = models.TextField()
last = models.TextField()
email = models.EmailField(default=None)
screen = models.TextField()
password = models.EncryptedCharField()
icon = models.ImageField(upload_to='avatars/')
When I attempt to validate the model (running syncdb) it gives me an error that states that the "EncryptedCharField" is not defined.
I have the code from that snippet present in my model.py file- is this incorrect? do i need to implement this snippet elsewhere, or have it extend a different class?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这表明
EncryptedCharField
未在models
中定义。如果它是在当前模块中定义的,那么您不应该尝试从不同的模块引用它。It's saying that
EncryptedCharField
is not defined inmodels
. If it's defined in the current module then you should not be trying to reference it from a different module.