Hey, I already answered you on stackoverflow.
db.select returns list of storages (webpy flavored dicts). And for Dropdown
args you need list or list of tuples.
form.option.args = [(o.name, o.name) for o in options]
or simply
form.option.args = [o.name for o in options]
On Wednesday, October 24, 2012 6:47:43 AM UTC+4, Andrew Kowalik wrote:
>
> I am missing something rather simple but cannot figure out how to properly
> read a db.select query for use in form args.
>
> Sample Code:
>
> class index:
> form = web.form.Form(form.Dropdown(name='option',args=[]))
>
> def GET(self):
> dbresult = db.select('test')
> options = db.select('test',what='name',group='name')
> form = self.form()
> form.option.args = options
> return render.index(dbresult,form)
>
> This return (Storage {'name': u'google'}) as one of the form args. All I
> want is google read back. I know I am missing something simple, any
> pointers? Thanks.
>
--
You received this message because you are subscribed to the Google Groups
"web.py" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/webpy/-/jxDpBXLpAc0J.
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/webpy?hl=en.