Re: [web2py] Re: Limit view of posts online

2015-03-23 Thread Maurice Waka
And thanks everybody too.

On Tue, Mar 24, 2015 at 6:25 AM, Maurice Waka  wrote:

> Thanks Anthony. I saw the answer you posted about 4 hrs ago.
> Kind regards
>
> On Tue, Mar 24, 2015 at 3:38 AM, Anthony  wrote:
>
>> See the answer here: http://stackoverflow.com/a/29222859/440323
>>
>> On Monday, March 23, 2015 at 12:10:22 PM UTC-4, Maurice Waka wrote:
>>
>>> I tried a Reddit app where one can view posts and comments.
>>> My trouble is getting the user t be the only one to view the Posts
>>> instead of public view(all postS seen by everyone)
>>> How do I limit that?
>>> I tried:
>>> @auth.requires_signature()
>>> def view_posts_by_author():
>>> ...code
>>> return locals()
>>>
>>> but this does not help
>>>
>>> Rgards
>>>
>>>  --
>> 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/1RxdnkozPVE/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: Limit view of posts online

2015-03-23 Thread Maurice Waka
Thanks Anthony. I saw the answer you posted about 4 hrs ago.
Kind regards

On Tue, Mar 24, 2015 at 3:38 AM, Anthony  wrote:

> See the answer here: http://stackoverflow.com/a/29222859/440323
>
> On Monday, March 23, 2015 at 12:10:22 PM UTC-4, Maurice Waka wrote:
>
>> I tried a Reddit app where one can view posts and comments.
>> My trouble is getting the user t be the only one to view the Posts
>> instead of public view(all postS seen by everyone)
>> How do I limit that?
>> I tried:
>> @auth.requires_signature()
>> def view_posts_by_author():
>> ...code
>> return locals()
>>
>> but this does not help
>>
>> Rgards
>>
>>  --
> 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/1RxdnkozPVE/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: Limit view of posts online

2015-03-23 Thread Anthony
See the answer here: http://stackoverflow.com/a/29222859/440323

On Monday, March 23, 2015 at 12:10:22 PM UTC-4, Maurice Waka wrote:
>
> I tried a Reddit app where one can view posts and comments.
> My trouble is getting the user t be the only one to view the Posts instead 
> of public view(all postS seen by everyone)
> How do I limit that?
> I tried:
> @auth.requires_signature()
> def view_posts_by_author():
> ...code
> return locals()
>
> but this does not help
>
> Rgards
>
>

-- 
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: Limit view of posts online

2015-03-23 Thread Anthony
On Monday, March 23, 2015 at 7:26:44 PM UTC-4, Ron Chatterjee wrote:
>
> There are various ways to do it. I will put a breakpoint and start typing 
> on the shell to figure out what you want to print. One way I can think of, 
>
> db().select(db.user_posts.ALL,orderby=auth.user.id, limitby=(0, 
> whatever_number_of_post_you_want_to_display);
>

He wants to display posts by a particular author, so simply limiting the 
number or records returned won't help. Instead, the query must specify the 
author.

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.


[web2py] Re: Limit view of posts online

2015-03-23 Thread Ron Chatterjee
There are various ways to do it. I will put a breakpoint and start typing 
on the shell to figure out what you want to print. One way I can think of, 

db().select(db.user_posts.ALL,orderby=auth.user.id, limitby=(0, 
whatever_number_of_post_you_want_to_display);


On Monday, March 23, 2015 at 5:42:34 PM UTC-4, Jim S wrote:
>
> Wouldn't you do this instead?
>
> user_posts = db(db.user_posts.posted_by==auth.user.id 
> ).select()
>
> I agree, it would be better if we could see the code you have so far...
>
> -Jim
>
> On Monday, March 23, 2015 at 11:23:04 AM UTC-5, LoveWeb2py wrote:
>>
>> Hi Maurice,
>>
>> You could do something like this:
>>user_posts = db(db.user_posts.posted_by==db.auth_user.id
>> ).select(db.user_posts.ALL)
>>
>> then show that data to just the user. Kind of hard to structure without 
>> seeing your database model.
>>
>> On Monday, March 23, 2015 at 12:10:22 PM UTC-4, Maurice Waka wrote:
>>>
>>> I tried a Reddit app where one can view posts and comments.
>>> My trouble is getting the user t be the only one to view the Posts 
>>> instead of public view(all postS seen by everyone)
>>> How do I limit that?
>>> I tried:
>>> @auth.requires_signature()
>>> def view_posts_by_author():
>>> ...code
>>> return locals()
>>>
>>> but this does not help
>>>
>>> Rgards
>>>
>>>

-- 
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: Limit view of posts online

2015-03-23 Thread Jim S
Wouldn't you do this instead?

user_posts = db(db.user_posts.posted_by==auth.user.id 
).select()

I agree, it would be better if we could see the code you have so far...

-Jim

On Monday, March 23, 2015 at 11:23:04 AM UTC-5, LoveWeb2py wrote:
>
> Hi Maurice,
>
> You could do something like this:
>user_posts = db(db.user_posts.posted_by==db.auth_user.id
> ).select(db.user_posts.ALL)
>
> then show that data to just the user. Kind of hard to structure without 
> seeing your database model.
>
> On Monday, March 23, 2015 at 12:10:22 PM UTC-4, Maurice Waka wrote:
>>
>> I tried a Reddit app where one can view posts and comments.
>> My trouble is getting the user t be the only one to view the Posts 
>> instead of public view(all postS seen by everyone)
>> How do I limit that?
>> I tried:
>> @auth.requires_signature()
>> def view_posts_by_author():
>> ...code
>> return locals()
>>
>> but this does not help
>>
>> Rgards
>>
>>

-- 
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: Limit view of posts online

2015-03-23 Thread Ron Chatterjee
you may want to try the "limitby" option. 

On Monday, March 23, 2015 at 12:49:39 PM UTC-4, Maurice Waka wrote:
>
> Hi loveweb2py.
> Its just the same as the Reddit clone on the tutorials. All  wanted is to 
> modify to have such posts to one user only.
>
> On Mon, Mar 23, 2015 at 7:23 PM, LoveWeb2py  > wrote:
>
>> Hi Maurice,
>>
>> You could do something like this:
>>user_posts = db(db.user_posts.posted_by==db.auth_user.id
>> ).select(db.user_posts.ALL)
>>
>> then show that data to just the user. Kind of hard to structure without 
>> seeing your database model.
>>
>>
>> On Monday, March 23, 2015 at 12:10:22 PM UTC-4, Maurice Waka wrote:
>>>
>>> I tried a Reddit app where one can view posts and comments.
>>> My trouble is getting the user t be the only one to view the Posts 
>>> instead of public view(all postS seen by everyone)
>>> How do I limit that?
>>> I tried:
>>> @auth.requires_signature()
>>> def view_posts_by_author():
>>> ...code
>>> return locals()
>>>
>>> but this does not help
>>>
>>> Rgards
>>>
>>>  -- 
>> 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/1RxdnkozPVE/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to 
>> web2py+un...@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: Limit view of posts online

2015-03-23 Thread Maurice Waka
Hi loveweb2py.
Its just the same as the Reddit clone on the tutorials. All  wanted is to
modify to have such posts to one user only.

On Mon, Mar 23, 2015 at 7:23 PM, LoveWeb2py  wrote:

> Hi Maurice,
>
> You could do something like this:
>user_posts = db(db.user_posts.posted_by==db.auth_user.id
> ).select(db.user_posts.ALL)
>
> then show that data to just the user. Kind of hard to structure without
> seeing your database model.
>
>
> On Monday, March 23, 2015 at 12:10:22 PM UTC-4, Maurice Waka wrote:
>>
>> I tried a Reddit app where one can view posts and comments.
>> My trouble is getting the user t be the only one to view the Posts
>> instead of public view(all postS seen by everyone)
>> How do I limit that?
>> I tried:
>> @auth.requires_signature()
>> def view_posts_by_author():
>> ...code
>> return locals()
>>
>> but this does not help
>>
>> Rgards
>>
>>  --
> 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/1RxdnkozPVE/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: Limit view of posts online

2015-03-23 Thread LoveWeb2py
Hi Maurice,

You could do something like this:
   user_posts = 
db(db.user_posts.posted_by==db.auth_user.id).select(db.user_posts.ALL)

then show that data to just the user. Kind of hard to structure without 
seeing your database model.

On Monday, March 23, 2015 at 12:10:22 PM UTC-4, Maurice Waka wrote:
>
> I tried a Reddit app where one can view posts and comments.
> My trouble is getting the user t be the only one to view the Posts instead 
> of public view(all postS seen by everyone)
> How do I limit that?
> I tried:
> @auth.requires_signature()
> def view_posts_by_author():
> ...code
> return locals()
>
> but this does not help
>
> Rgards
>
>

-- 
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.