controller:
-------------------------------------
results = TableToDisplay.select()
return dict(results=results)
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?
On 3 Jul., 09:49, SMERSH009 <[EMAIL PROTECTED]> wrote:
> Hi All,
> I am trying to display Data from a database table to display in a
> Table format.
> Right now the results are just being bunched up together. For example,
> when displayed in the web browser the ${ids} returns 1922 instead of
> 19
> 22
> Now I know that this seems like a basic question, but I looked all
> over the tutorials, and they seem to concentrate on displaying ALL the
> data at once, and not to display one row at a time.
>
> 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!
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---