Reading this document at present,
http://turbogears.org/2.1/docs/main/FormBasics.html,
trying to get some forms working.
I have a preexisting database with a table "team" in it. I have no
problem fetching the data out of the table from my RootController.
Here's what I have done so far:
In /controllers/root.py,
from jimmytest.model import team
from tg import tmpl_context
from sprox.formbase import AddRecordForm
class NewTeamForm(AddRecordForm):
__model__=team
new_team_form=NewTeamForm(DBSession)
And in the RootController class, I have defined a function as below;
class RootController(BaseController):
(...)
@expose("jimmytest.templates.sprox_newteam")
def sprox_newteam(self,**kw):
try:
name="sprox_newteam"
tmpl_context.widget=new_team_form
return dict(page=name,value=kw)
except Exception,e:
raise redirect("/error_redir",error=str(e))#"unknown
error")
@expose("jimmytest.templates.error_redir")
def error_redir(self,error):
name="error_redir"
return dict(page=name,error=error)
The function gets called and processed without throwing any errors.
But my template, sprox_newteam.html, doesn't seem to handle the line, $
{tmpl_context.widget(value=value)}.
Also, please let me know if there's any good way of handling errors on
the template side, because I don't get much information out of the 500
error message.
Thanks lots in advance. 8^)
--
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.