when trying to view posts created by author, i tried this piece of code on controller:
- option one: replies = db(db.answers.posted_by==auth.user_id).select(orderby=~db.answers.posted_by,limitby=(0,10))
- option two where the author has two fields populated with information:
- questions = db(db.answers.quest == auth.user_id).select()
- 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:
- Option one: all authors posts are seen on view
{{for reply in replies:}}
{{=reply.quest}}
{{=reply.report.}}
{{pass}}
- 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