Sequence of Mapping Widgets

    Add Person

Captured

None

Code (show in context)

    @view_config(renderer='templates/form.pt', name='sequence_of_mappings')
    @demonstrate('Sequence of Mapping Widgets')
    def 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)