@view_config(renderer="templates/form.pt", name="textareacsv")
@demonstrate("Text Area CSV Widget")
def textareacsv(self):
class Row(colander.TupleSchema):
first = colander.SchemaNode(colander.Integer())
second = colander.SchemaNode(colander.String())
third = colander.SchemaNode(colander.Decimal())
class Rows(colander.SequenceSchema):
row = Row()
class Schema(colander.Schema):
csv = Rows()
schema = Schema()
form = deform.Form(schema, buttons=("submit",))
form["csv"].widget = deform.widget.TextAreaCSVWidget(rows=10, cols=60)
appstruct = {"csv": [(1, "hello", 4.5), (2, "goodbye", 5.5)]}
return self.render_form(form, appstruct=appstruct)