@view_config(
renderer="templates/form.pt", name="readonly_sequence_of_mappings"
)
@demonstrate("Sequence of Mappings (read-only)")
def readonly_sequence_of_mappings(self):
class Person(colander.Schema):
name = colander.SchemaNode(colander.String())
age = colander.SchemaNode(
colander.Integer(), validator=colander.Range(0, 200)
)
class People(colander.SequenceSchema):
person = Person()
class Schema(colander.Schema):
people = People()
schema = Schema()
form = deform.Form(schema, buttons=("submit",))
return self.render_form(
form,
appstruct={
"people": [
{"name": "name1", "age": 23},
{"name": "name2", "age": 25},
]
},
readonly=True,
)