when trying to view posts created by author, i tried this piece of code on
controller:
1. option one: replies =
db(db.answers.posted_by==auth.user_id).select(orderby=~db.answers.posted_by,limitby=(0,10))
2. option two where the author has two fields populated with information:
1. questions = db(db.answers.quest == auth.user_id).select()
2. replies = db(db.answers.report == auth.user_id).select()
With above options, i keep getting a blank screen., but messages are posted
to the database
With this option below, i get to view all posts by not only the author's
posts but by all authors logged. I want it private that ONLY the author can
view his/her posts.
- replies = db(db.answers).select()
- return dict(replies=replies)
The code on the models is:
db.define_table('answers',
Field('quest', 'text', 'reference auth_user'),
Field('report', 'text', 'reference auth_user'),
Field('posted_by','reference
auth_user',readable=False,writable=False),
auth.signature
)
code on view.html:
1. Option one: all authors posts are seen on view
{{for reply in replies:}}
{{=reply.quest}}
{{=reply.report.}}
{{pass}}
1. Option two. gives a blank screen/view
{{for question in questions:}}
{{=question.quest}}
{{pass}}
{{for reply in replies:}}
{{=reply.reportt}}
{{pass}}
I don't know where am going wrong. Please assist
Kind regards
--
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.