@view_config(renderer="templates/form.pt", name="radiochoice")
@demonstrate("Radio Choice Widget")
def radiochoice(self):
choices = (
("habanero", "Habanero"),
("jalapeno", "Jalapeno"),
("chipotle", "Chipotle"),
)
class Schema(colander.Schema):
pepper = colander.SchemaNode(
colander.String(),
validator=colander.OneOf([x[0] for x in choices]),
widget=deform.widget.RadioChoiceWidget(values=choices),
title="Choose your pepper",
description="Select a Pepper",
)
schema = Schema()
form = deform.Form(schema, buttons=("submit",))
return self.render_form(form)