我创建了2个漏勺模式,因为它们反映了我的数据库结构。我想用一个提交按钮而不是两个在一个页面上显示两个表单,这样当按下提交按钮时,它将同时验证和返回两个表单的错误。
我尝试仅将Submit放在一个表单变量上,但是当按下Submit时,仅对该特定表单进行了验证。有没有一种方法可以将“提交”按钮与变形表单结构分开?
import colander
# create colander schemas
class Person(colander.MappingSchema):
name = colander.SchemaNode(colander.String())
age = colander.SchemaNode(colander.Integer(),
validator=colander.Range(0, 200))
class People(colander.SequenceSchema):
person = Person()
class Schema(colander.MappingSchema):
people = People()
class Sample(colander.MappingSchema):
sample_ID = colander.SchemaNode(colander.String())
samplename = colander.SchemaNode(colander.Integer(),
validator=colander.Range(0, 200))
schema = Schema()
secondschema = Sample()
#create forms using deform
from deform import Form
myform = Form(schema, buttons=('submit',))
secondform = Form(secondschema, buttons=('submit'),)) ```