model.py contains:
class WebAppPages(SQLObject):
class sqlmeta:
style=Style(longID=True)
idName='pageID'
pageName= UnicodeCol()
url = UnicodeCol(notNone=True)
post = BoolCol(default=False)
controllers.py contains. And I am sure this is wrong...:
class Root(controllers.RootController):
@expose(template="formstutorial.templates.index")
def index(self):
result= WebAppPages.select()
names = map(lambda x: x.pageName ,list(result))
urls = map(lambda x: x.url , list(result))
ids = map(lambda x: x.id , list(result))
return dict(names=names,urls=urls,ids=ids)
index.kid contains:
<html>
<head><title>Webapptests</title></head>
<body>
${urls}
${names}
${ids}
</body>
</html>
Thank you!
hi,
i'm about to finish a small piece of code that will display all rows in
a table of your choice, with the option to also add, delete and update
rows through ajax.
hope to publish this today or tomorrow.
alex
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iQCVAwUBRooEJdpwN1sq38njAQL7OwP6A9wBXY4ILqZicxBX+9e3vGO/JsdKVOhS
lJHkE9iMizci6lPEbNczpYNqLLRw1sPB7R46UwWq3xKccfwX/PbITc3nHJred3bB
KK32cuBVezweeScm9Qc367/8EaCEy2Sswo6yW0pG5+Oje0qvIzxBjKE7zfC0DoCF
/CcEmP6SxIM=
=cvPo
-----END PGP SIGNATURE-----
template
------------------------------------------
<html>
<head><title>Webapptests</title></head>
<body>
<table>
<tr py:for="row in result">
<td py:content="row['name']">
<td py:content="row['url']">
<td py:content="row['id']">
</tr>
</table>
</body>
</html>
---------------------------------------------
doesn´t this work?
Alex, since having to edit these rows was going to be the next step
in this difficult project (I am a newbie to Python), you are going to
be my lifesaver if your code will work. I will keep checking the
thread for your guys' updates.
On Jul 3, 4:12 am, Johnny Blonde <frank.wagner.1...@googlemail.com>
wrote:
Turbogears1.0 Python v2.5.1c
Here is what the template file looks like in my code to match the
columns in my DB.
Thanks...
<html>
<head><title>Webapptests</title></head>
<body>
<tr py:for="row in results">
<td py:content="row['pageID']">
<td py:content="row['pageName']">
<td py:content="row['url']">
</tr>
</table>
</body>
</html>
Happy 4th of July everyone!!
<!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>
<title>Webapptests</title></head>
<body>
<table border="1">
<tr py:for="row in results">
<td py:content="row.id"></td>
<td py:content="row.pageName"></td>
<td py:content="row.url"></td>
</tr>
</table>
</body>
</html>