如題,在調試Django時報錯,不知哪里出了問題,求大佬解答!!!
class MobileModelForm(forms.ModelForm):
# Exception Value: join() argument must be str, bytes, or os.PathLike object, not 'dict'
mobile = forms.CharField(
label='手機號',
validators=[RegexValidator(regex=r"^1[3-9]\d{9}$", message="手機號碼格式錯誤"),]
)
class Meta:
model = models.PrettyNum
fields = ["mobile","price","level","status"]
# fields = "__all__" # 所有字段
# exclude = ["level"] # 排除哪些字段
def __init__(self,*args,**kwargs):
super().__init__(*args,**kwargs)
for name,field in self.fields.items():
field.widget.attrs = {"class":"form-control"}
添加了validators=[RegexValidator(regex=r"^1[3-9]\d{9}$", message="手機號碼格式錯誤"),]
這句話就報錯,懵了
TypeError
Exception Value:
join() argument must be str or bytes, not 'dict'
我知道我哪里錯了,忘記寫request
了