【发布时间】:2020-10-24 18:12:17
【问题描述】:
我的 models.py 中有这段代码:
from django import forms
class user_Account(models.Model):
password = models.CharField(
widget=forms.PasswordInput(),
verbose_name="Password",
max_length=500,
null=True,
blank=True
)
这是我的forms.py:
from django import forms
from Account.models import user_Account
class UserForm(forms.ModelForm):
password = forms.CharField(widget=forms.PasswordInput)
class Meta:
model = user_Account
为什么会出现这个错误?
TypeError: __init__() got an unexpected keyword argument 'widget'
我错过了什么吗?
【问题讨论】: