I'm trying to make a tracker that users input data.
So far its successful with this code:
form = SQLFORM(db.weight, submit_button=T('Submit')).process()
How ever, I need an author specific data, but can't get around this code:
form = SQLFORM((db.weight.author == auth.user.id).select(db.weight),
submit_button=T('Submit')).process()
This is the error that comes:
Traceback
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
Traceback (most recent call last):
File "/home/mauricewaka/web2py/gluon/restricted.py", line 219, in restricted
exec(ccode, environment)
File
"/home/mauricewaka/web2py/applications/Hestque_Wellness/controllers/e_default.py"
<http://127.0.0.1:8000/admin/default/edit/Hestque_Wellness/controllers/e_default.py>,
line 667, in <module>
File "/home/mauricewaka/web2py/gluon/globals.py", line 421, in <lambda>
self._caller = lambda f: f()
File
"/home/mauricewaka/web2py/applications/Hestque_Wellness/controllers/e_default.py"
<http://127.0.0.1:8000/admin/default/edit/Hestque_Wellness/controllers/e_default.py>,
line 510, in myWeight
form = SQLFORM(db.weight.author == auth.user.id,
submit_button=T('Submit')).process()
File "/home/mauricewaka/web2py/gluon/sqlhtml.py", line 1354, in __init__
fields = [f.name for f in table if (ignore_rw or f.writable or (f.readable
and f.default)) and not f.compute]
TypeError: 'Query' object is not iterable
This is because I'll need a chart in the view with this code:
chart = pygal.StackedLine(fill=True, interpolate='cubic', style=BlueStyle)
data = db(db.weight).select()
chart.add('W', [i.weight for i in data])
return chart.render()
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.