如何获取 django 的密码文本框?
class Users(models.Model):
username = models.CharField(max_length=255)
password = models.CharField(max_length=300)
password_token = models.CharField(max_length=300, default='0')
密码文本输入字段是常规文本输入字段。这不是密码字段。
如何在 django 中获取密码字段?
我尝试了 password = models.CharField(max_length=300, widget=forms.PasswordInput )
但出现错误。
class Users(models.Model):
username = models.CharField(max_length=255)
password = models.CharField(max_length=300)
password_token = models.CharField(max_length=300, default='0')
The password text input field is regular text input field. It's not password field.
How can I get password field in django?
I tried password = models.CharField(max_length=300, widget=forms.PasswordInput )
but got error.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
如果您的应用程序中有 forms.py,一种方法是在您的 Meta 类中指定小部件,例如
One way if you have a forms.py in your app is to specify the widgets in your class Meta e.g.
小部件在表单中分配,而不是在模型上分配。
请参阅表单文档的文档: https://docs.djangoproject.com/ en/dev/ref/forms/widgets/
Widgets are assigned in the forms, not on the model.
Please see the docs for forms documentation: https://docs.djangoproject.com/en/dev/ref/forms/widgets/
您可以使用这种方法。在您的应用程序中创建一个名为 forms.py 的文件。
例如:
You can use this approach. Create a file named forms.py inside your app.
for example: