@view_config(renderer="templates/form.pt", name="radiochoice_readonly")
@demonstrate("Radio Choice Widget (read-only)")
def radiochoice_readonly(self):
choices = (
("habanero", "Habanero"),
("jalapeno", "Jalapeno"),
("chipotle", "Chipotle"),
)
class Schema(colander.Schema):
pepper = colander.SchemaNode(
colander.String(),
widget=deform.widget.RadioChoiceWidget(
values=choices, readonly=True
),
)
schema = Schema()
form = deform.Form(schema, buttons=("submit",))
return self.render_form(form, appstruct={"pepper": "jalapeno"})