class LocationForm(widget.FieldSet): _fields = ["city", "state", "address"] cls = "location" city = widget.Input() state = widget.Input() address = AddressForm()
class SimpleForm(widget.Form): _fields = ["name", "age", "phone"] name = widget.Input(label="Name") age = widget.Input( label="Age", description="This is today minus the date you were born in seconds.") phone = widget.Input(label="Phone")
class PersonForm(widget.Form): _action = '/save_person' _id = "person_woot" #if anyone knows a better way to maintain the order of the fields, please let me know! _fields = ["human_id", "name", "age", "location"] human_id = widget.Input(label="ID") name = widget.Input(label="Name") age = widget.Input(label="Age", description="This is today minus the date you were born in seconds.") location = LocationForm(label="Location")
class HumanForm(widget.Form): #if anyone knows a better way to maintain the order of the fields, please let me know! _fields = ["name", "age", "weight", "location"] name = widget.Input(label="Name") age = widget.Input( label="Age", description="This is today minus the date you were born in seconds.") weight = widget.Input(label="Weight") location = LocationForm(label="Location")
class PersonForm(widget.Form): action = '/save_person' id = "person_%s" % chris._id _prepend = "test" #if anyone knows a better way to maintain the order of the fields, please let me know! _fields = ["human_id", "name", "age", "car", "location", "jobs", "email"] human_id = widget.Input(label="ID") name = widget.Input(label="Name") age = widget.Input( label="Age", description="This is today minus the date you were born in seconds.") car = widget.Select(label="Car", item_render=car_disp) location = LocationForm(label="Location") jobs = widget.MultipleSelect(label="Jobs", item_render=job_list) email = widget.Input(label="Email")
class LocationForm(widget.FieldSet): _fields = ["city"] _cls = "location" city = widget.Input()
class AddressForm(widget.FieldSet): _fields = ["street", "street2", "zip"] street = widget.Input() street2 = widget.TextArea(cls="Woot", rows=10, cols=30) zip = widget.Input()
class LocationForm(widget.FieldSet): _fields = ["city", "address"] city = widget.Input(label="City") address = AddressForm(label="Address")
class AddressForm(widget.FieldSet): _fields = ["street", "zip"] street = widget.Input(label="Street") zip = widget.Input(label="Zip")
def test_input_render(self): text = widget.Input(object=self.car._get("make"), name="make").render(cls="red checked") self.assertEqual(text.strip(), self.text_html.strip())