Re: [web2py] Re: Why do I get a blank screen on view

2017-06-20 Thread Anthony
On Tuesday, June 20, 2017 at 11:25:20 AM UTC-4, Maurice Waka wrote:
>
> I did this:
> replies = db().select(db.answers.ALL, orderby=auth.user.id)
>

orderby must be a Field object, not an integer value.
 

>
> could it be because am using the same local ip(127.0.0.8000) address when 
> trying out different users and get the same result?
>

auth.user is the user record of the currently logged in user. If *you* are 
logged in, then it will always be *your* user record.

Anthony

-- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [web2py] Re: Why do I get a blank screen on view

2017-06-20 Thread Maurice Waka
I did this:
replies = db().select(db.answers.ALL, orderby=auth.user.id)

could it be because am using the same local ip(127.0.0.8000) address when
trying out different users and get the same result?


On Sat, Jun 17, 2017 at 8:25 PM, Anthony  wrote:

> auth.user_id is the id of the logged in user or None if the current user
> is not logged in. There is no "default" user. Unless the "quest" and
> "report" fields are sometimes set to None rather than an actual user id,
> your second set of queries will never return any results.
>
> Anthony
>
>
> On Saturday, June 17, 2017 at 7:24:42 AM UTC-4, Maurice Waka wrote:
>>
>>
>> db.define_table('answers',
>> Field('quest', 'text', default =auth. user_id) ,
>> Field('report', 'text', default =auth. user_id)
>> auth.signature
>> )
>>
>> On default controller  :
>>
>>- replies  =  db(db.answers).select()
>>- return dict(replies=replies)
>>
>> With this I still have the same problem where all posts by logged in
>> users are viewed instead of the specific ones by the default user.
>> If I do this on default controller:
>>
>>1.  questions = db(db.answers.quest == auth.user_id).select()
>>2.  replies  =  db(db.answers.report == auth.user_id).select()
>>
>> I still get a blank screen.
>>
>> On Jun 15, 2017 09:08, "黄祥"  wrote:
>>
>>> just an idea, why not put the default value for that fields?
>>> e.g.
>>> default = auth.user_id
>>>
>>> best regards,
>>> stifan
>>>
>>> --
>>> 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 a topic in the
>>> Google Groups "web2py-users" group.
>>> To unsubscribe from this topic, visit https://groups.google.com/d/to
>>> pic/web2py/Msoj2qZO7RU/unsubscribe.
>>> To unsubscribe from this group and all its topics, send an email to
>>> web2py+unsubscr...@googlegroups.com.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>> --
> 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 a topic in the
> Google Groups "web2py-users" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/
> topic/web2py/Msoj2qZO7RU/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [web2py] Re: Why do I get a blank screen on view

2017-06-17 Thread Anthony
auth.user_id is the id of the logged in user or None if the current user is 
not logged in. There is no "default" user. Unless the "quest" and "report" 
fields are sometimes set to None rather than an actual user id, your second 
set of queries will never return any results.

Anthony

On Saturday, June 17, 2017 at 7:24:42 AM UTC-4, Maurice Waka wrote:
>
>
> db.define_table('answers',
> Field('quest', 'text', default =auth. user_id) ,
> Field('report', 'text', default =auth. user_id)
> auth.signature
> )
>
> On default controller  :
>
>- replies  =  db(db.answers).select()
>- return dict(replies=replies)
>
> With this I still have the same problem where all posts by logged in users 
> are viewed instead of the specific ones by the default user. 
> If I do this on default controller:
>
>1.  questions = db(db.answers.quest == auth.user_id).select()
>2.  replies  =  db(db.answers.report == auth.user_id).select()
>
> I still get a blank screen. 
>
> On Jun 15, 2017 09:08, "黄祥"  wrote:
>
>> just an idea, why not put the default value for that fields? 
>> e.g.
>> default = auth.user_id
>>
>> best regards,
>> stifan
>>
>> -- 
>> 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 a topic in the 
>> Google Groups "web2py-users" group.
>> To unsubscribe from this topic, visit 
>> https://groups.google.com/d/topic/web2py/Msoj2qZO7RU/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to 
>> web2py+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>>
>

-- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [web2py] Re: Why do I get a blank screen on view

2017-06-17 Thread Maurice Waka
db.define_table('answers',
Field('quest', 'text', default =auth. user_id) ,
Field('report', 'text', default =auth. user_id)
auth.signature
)

On default controller  :

   - replies  =  db(db.answers).select()
   - return dict(replies=replies)

With this I still have the same problem where all posts by logged in users
are viewed instead of the specific ones by the default user.
If I do this on default controller:

   1.  questions = db(db.answers.quest == auth.user_id).select()
   2.  replies  =  db(db.answers.report == auth.user_id).select()

I still get a blank screen.

On Jun 15, 2017 09:08, "黄祥"  wrote:

> just an idea, why not put the default value for that fields?
> e.g.
> default = auth.user_id
>
> best regards,
> stifan
>
> --
> 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 a topic in the
> Google Groups "web2py-users" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/
> topic/web2py/Msoj2qZO7RU/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [web2py] Re: Why do I get a blank screen on view

2017-06-15 Thread Maurice Waka
Thanks. Once logged in I'll fix it.
Regards

On Jun 15, 2017 09:19, "Anthony"  wrote:

> On Thursday, June 15, 2017 at 1:48:51 AM UTC-4, Maurice Waka wrote:
>>
>> Sorry. Am not sure about value of Auth.user_id
>>
>
> It is the id of the current logged in user. You can simply display it on
> the page or print it to the console to inspect it.
>
> Anthony
>
> --
> 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 a topic in the
> Google Groups "web2py-users" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/
> topic/web2py/Msoj2qZO7RU/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [web2py] Re: Why do I get a blank screen on view

2017-06-15 Thread Anthony
On Thursday, June 15, 2017 at 1:48:51 AM UTC-4, Maurice Waka wrote:
>
> Sorry. Am not sure about value of Auth.user_id
>

It is the id of the current logged in user. You can simply display it on 
the page or print it to the console to inspect it.

Anthony

-- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [web2py] Re: Why do I get a blank screen on view

2017-06-15 Thread 黄祥
just an idea, why not put the default value for that fields? 
e.g.
default = auth.user_id

best regards,
stifan

-- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [web2py] Re: Why do I get a blank screen on view

2017-06-14 Thread Maurice Waka
Sorry. Am not sure about value of Auth.user_id

On Jun 15, 2017 07:25, "Anthony"  wrote:

> What is the value of auth.user_id? Are you sure there are records in the
> database whose "post_by" value is equal to it?
>
> On Thursday, June 15, 2017 at 12:03:54 AM UTC-4, Maurice Waka wrote:
>>
>> 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 a topic in the
> Google Groups "web2py-users" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/
> topic/web2py/Msoj2qZO7RU/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Why do I get a blank screen on view

2017-06-14 Thread Anthony
What is the value of auth.user_id? Are you sure there are records in the 
database whose "post_by" value is equal to it?

On Thursday, June 15, 2017 at 12:03:54 AM UTC-4, Maurice Waka wrote:
>
> 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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.