def __init__(self, context, request): self.context = context self.request = request self.form = form.CSRFForm(ProfileSchema(), defaults=self.context.__dict__) self.form["password"].widget = formish.CheckedPassword() self.form["logo"].widget = formish.FileUpload()
def get_form(request): schema = Registration() for q in get_questions(request): schema.add(q, schemaish.String(validator=validatish.Required())) form = formish.Form(schema) form['password'].widget = formish.CheckedPassword() return form
def get_form(request): schema = schemaish.Structure() schema.add('username', schemaish.String()) schema.add('password', schemaish.String()) for q in get_questions(request): schema.add(q, schemaish.String(validator=validatish.Required())) form = formish.Form(schema) form['password'].widget = formish.CheckedPassword() return form
def test_complex_form(self): one = schemaish.Structure([ ("a", schemaish.String(validator=v.All(v.Email(), v.Required()))), ("b", schemaish.String()), ("c", schemaish.Sequence(schemaish.Integer())) ]) two = schemaish.Structure([("a", schemaish.String()), ("b", schemaish.Date()),\ ('c', schemaish.Sequence(schemaish.String())), ("d", schemaish.String()), \ ("e", schemaish.Integer(validator=v.Required())), ("f", schemaish.String(validator=v.Required())) ]) schema = schemaish.Structure([("one", one), ("two", two)]) f = formish.Form(schema, name="form", add_default_action=False) f['one.b'].widget = formish.TextArea() f['two.a'].widget = formish.SelectChoice( [('opt1', "Options 1"), ('opt2', "Option 2")], none_option=('-select option-', None)) f['two.b'].widget = formish.DateParts() f['two.c'].widget = formish.CheckboxMultiChoice([('opt1', "Options 1"), ('opt2', "Option 2")]) f['two.d'].widget = formish.RadioChoice([('opt1', "Options 1"), ('opt2', "Option 2")]) f['two.f'].widget = formish.CheckedPassword() f.add_action('submit', "Submit Me") f.defaults = { 'one': { 'a': 'ooteenee', 'c': ['3', '4', '5'] }, 'two': { 'a': 'opt1', 'b': date(1966, 1, 3), 'c': ['opt2'], 'd': 'opt2' } } f()
def __init__(self, request): self.request = request self.form = form.Form(SignupSchema()) self.form["password"].widget = formish.CheckedPassword() self.form["terms"].widget = formish.Checkbox()
def get_form(request): schema = Registration() form = formish.Form(schema) form['password'].widget = formish.CheckedPassword() return form