@view_config(
renderer="templates/form.pt",
name="sequence_of_fileuploads_with_initial_item",
)
@demonstrate("Sequence of File Upload Widgets (with Initial Item)")
def sequence_of_fileuploads_with_initial_item(self):
class Sequence(colander.SequenceSchema):
upload = colander.SchemaNode(
deform.FileData(),
widget=deform.widget.FileUploadWidget(tmpstore),
)
class Schema(colander.Schema):
uploads = Sequence()
schema = Schema()
form = deform.Form(schema, buttons=("submit",))
form["uploads"].widget = deform.widget.SequenceWidget(min_len=1)
return self.render_form(form, success=tmpstore.clear)