Following the example in the new book under components:
Model:
db.define_table("comment_post", Field("body", "text", label="Your
comment"), auth.signature)
Controller:
@auth.requires_login()
def post(): return dict(form = SQLFORM(db.comment_post).process(), comments
= db(db.comment_post).select())
View:
{{extend 'layout.html'}}
{{for comment in comments:}}
<div class="post">
{{=comment.created_by.first_name}} on
{{=comment.created_on}} said: <span
class="post_body">"{{=comment.body}}</span>
</div>
{{pass}}
{{=form}}
Error Trace:
Versionweb2py™(2, 4, 2, 'stable', datetime.datetime(2013, 3, 4, 3, 26, 21))
PythonPython 2.7.3:
/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python
(prefix: /Library/Frameworks/Python.framework/Versions/2.7)Traceback
1.
2.
3.
4.
5.
6.
Traceback (most recent call last):
File "/Users/teddyl/Documents/src/web2py/gluon/restricted.py", line
212, in restricted
exec ccode in environment
File
"/Users/teddyl/Documents/src/web2py/applications/testapp/views/comments/post.html",
line 85, in <module>
AttributeError: 'NoneType' object has no attribute 'first_name'
Error snapshot [image:
help]<http://localhost:8000/admin/default/ticket/testapp/127.0.0.1.2013-03-06.09-40-30.a9801d29-f1d9-46e9-82f2-bccfbf1c0292#>
<type 'exceptions.AttributeError'>('NoneType' object has no attribute
'first_name')
--
.......................................................................................
Teddy Lubasi Nyambe
Opensource Zambia
Lusaka, ZAMBIA
Cell: +260 97 7760473
website: http://www.opensource.org.zm
~/
Human Knowledge belongs to the world! - AntiTrust
Man is a tool-using animal. Without tools he is nothing, with tools he is
all - Thomas Carlyle 1795-1881
/~
--
---
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/groups/opt_out.