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