当我尝试将表单数据插入表单时,我收到一个错误,对象没有属性“is_valid”。下面是我的代码结构: 模型.py enter image description here
视图.py enter image description here
index.html enter image description here
答案 0 :(得分:0)
--conf "spark.driver.extraClassPath=phoenix-spark2.jar:phoenix-client.jar:/etc/hbase/conf"
--conf "spark.executor.extraClassPath=phoenix-spark2.jar:phoenix-client.jar:/etc/hbase/conf"
真的没有意义。您不能将模型/实例分配给变量并将其视为一种形式。相反,根据您的模型创建一个表单,如下所示:
创建一个文件 fm = Reg()
并在其中创建一个 ModelForm:
forms.py
ModelForm 让您根据模型创建表单。
现在将其导入到您的 views.py 中并使用 RegForm 而不是 Reg。