Hello,

I'm working with TG2 and trying to have an edit form that pulls data
from the DB and populates the fields in the tw.form.  I have tried to
do this in the controller.  Is this the correct approach?  Or is
something else wrong? I have tried a couple approachs to the
item_edit_form.updatedata and cannot find the right combo.

This is not much different then the Edit template in the Wiki20
tutorial, but using tw.forms.  Should this load be done in the
template instead?

The description and ItemInfo are not trying to be connected at this
point, just the title

Thanks.

kmcb

CURRENT ERROR
 ⇝  TypeError: 'NoneType' object is not callable
View as:   Interactive (full)  |  Text (full)  |  XML (full)
clear this
clear this
Module ?:23 in <Expression u'tmpl_context.edit_form()'>         view
<<    </div>
         <!--  <div py:replace="XML(content)">Formatted content goes
here.</div> -->
         <div py:replace="tmpl_context.edit_form()">Input Form</div>

         </div>
>>  <div py:replace="tmpl_context.edit_form()">Input Form</div>
TypeError: 'NoneType' object is not callable


itemw.py.....
class ItemEditForm(TableForm):
    action='create'
    class fields(WidgetsList):
        title = TextField(validator = String(not_empty=True))
        description = TextArea(validator = String(not_empty=True))
        ItemInfo = TinyMCE()

    def updatedata(self , title):
        self.fields.title = title
item_edit_form = ItemEditForm("item_edit_form", action =
'storeupdate')

controller.py.....

from wiki20.widgets.itemw import item_add_form , item_edit_form

    @expose('wiki20.templates.createitem.itemedit')
    def itemedit(self, item_id, **kw):

        item = DBSession.query(ItemM).filter_by(id=item_id).one()
        tmpl_context.edit_form = item_edit_form.updatedata(title =
item.title)
        return dict(page='itemedit', item=item)



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TurboGears" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to