Changeset 5589

Show
Ignore:
Timestamp:
10/23/08 14:21:36 (3 months ago)
Author:
mramm
Message:

Fixing FormBasics?.rst to not use tmpl_context.widgets anymore since that's not the "official" way to do it anymore.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • docs/2.0/docs/main/FormBasics.rst

    r5524 r5589  
    4545This 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.    
    4646 
    47 We can then add that widget to the list of widgets available in the template by adding it to tmpl_context.widgets in your controller:: 
     47We can then add that widget to the list of widgets available in the template by adding it to tmpl_context in your controller:: 
    4848     
    4949    @expose('myproject.templates.html') 
    5050    def display_login(self): 
    51         tmpl_context.widget.login_form = login_form 
     51        tmpl_context.login_form = login_form 
    5252        return dict() 
    5353         
    5454And then you can display it in your template by calling it like this::: 
    5555 
    56   ${tmpl_context.widget.login_form()} 
     56  ${tmpl_context.login_form()} 
    5757 
    5858When 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::