Changeset 5589
- Timestamp:
- 10/23/08 14:21:36 (3 months ago)
- Files:
-
- docs/2.0/docs/main/FormBasics.rst (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
docs/2.0/docs/main/FormBasics.rst
r5524 r5589 45 45 This form is actually a ToscaWidgets CompoundWidget object, with member widgets for each of the form fields, and with some code to wrap them up in a form and display them to the user. DBSprockets takes the User object introspects it's table information, and makes a form for you. In this case, we're limiting the fields that show up on the form to those needed for the user_name and password columns. 46 46 47 We can then add that widget to the list of widgets available in the template by adding it to tmpl_context .widgetsin your controller::47 We can then add that widget to the list of widgets available in the template by adding it to tmpl_context in your controller:: 48 48 49 49 @expose('myproject.templates.html') 50 50 def display_login(self): 51 tmpl_context. widget.login_form = login_form51 tmpl_context.login_form = login_form 52 52 return dict() 53 53 54 54 And then you can display it in your template by calling it like this::: 55 55 56 ${tmpl_context. widget.login_form()}56 ${tmpl_context.login_form()} 57 57 58 58 When you get the results back in your login method you can tell the @validate decorator to use the validators built into the form like this::