hey steve
Steve Bergman wrote:
Well, to be honest, I didn't realize that you *could* pass a model
object.

neither did I, but its what they do in 1 sample of the famous bookmark
example in chp5

I just created this simple project and it works.

yp - mine works as for as you've gone also... I noticed you used cat
walk to add your data, and you have no facility here to collect data
for a new record (saving  aside). Its in the collection of new data,
that your field1 returns the same thing as if you typed field1 at the
python prompt.


Thanks for you effort, appreciate it v much

Perhaps you will see something in this that will help:


Model.py:
============================
from turbogears.database import PackageHub
from sqlobject import *

hub = PackageHub("testproj")
__connection__ = hub

class pobj(SQLObject):
    field1 = StringCol()


(Don't forget to add a record or two with CatWalk.)


controllers.py
================
from turbogears import controllers, expose
from turbogears.widgets import TextField, TableForm, WidgetsList
from model import pobj

class TestFormFields(WidgetsList):
    field1 = TextField(label="TestField1:")

testform = TableForm(fields=TestFormFields())

class Root(controllers.RootController):
    @expose(template="testproj.templates.welcome")
    def index(self):
        p = pobj.get(1)
        return dict(form=testform, values = p)



welcome.kid
============================
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
<html xmlns="http://www.w3.org/1999/xhtml";
xmlns:py="http://purl.org/kid/ns#";
    py:extends="'master.kid'">
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type"
py:replace="''"/>
<title>Welcome to TurboGears</title>
</head>
<body>
${form(value=values)}
</body>
</html>


--~--~---------~--~----~------------~-------~--~----~
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