That does the trick. Thank you very much! :)

Am Montag, 22. April 2013 17:25:43 UTC+2 schrieb Niphlod:
>
> if the owner can have 0>n pets, you need to show him a list of his pets, 
> optionally letting him adding a pet to his list.
> The "form" in this context is a rather limited representation: usually 
> you'd want to display a form for insert/edit/delete for each pet but you 
> can't use a form for "listing" his current pets.
>
> What about using the grid ?
> Assuming that the pet table is linked to the auth_user one with a column 
> that references the id of the user named "owner_id", it's as easy as
>
> def list_my_pets():
>     db.pet.owner_id.default = auth.user_id
>     #db.pet.owner_id.readable = db.pet.owner_id.writable = False
>     #remove comment from the previous line if user "John" can't insert
>     #pets related to user "James"
>     grid = SQLFORM.grid(db.pet.owner_id == auth.user_id)
>     return dict(grid=grid)
>
>
>
>
> On Monday, April 22, 2013 5:09:11 PM UTC+2, Philipp Müller wrote:
>>
>> Hello,
>>
>> I would like to create a form using  
>>
>> > form = SQLFORM(db.pet)
>>
>> where db.pet belongs to db.owner.
>> This form is supposed to provide the owner (which is going to log in to 
>> the site) with the information about their (and only their) pets and let 
>> them edit this information. 
>>
>> Any help on how to do this would be highly appreciated.
>>
>> With kind regards,
>> Philipp
>>
>

-- 

--- 
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/groups/opt_out.


Reply via email to