db.pets.owner.filter_out = lambda owner: URL('default', 'api', args=[
'owners', owner])

See http://web2py.com/books/default/chapter/29/6#filter_in-and-filter_out.

Anthony

On Friday, June 14, 2013 8:40:42 AM UTC-4, R. Osinga wrote:
>
> hmmm, rather not. I'm looking for a generic solution.
> Well, nevermind then. It's not that big of an issue. The code calling my 
> services, knows the url pattern anyway.:-)
>
> On Friday, June 14, 2013 12:40:32 PM UTC+2, R. Osinga wrote:
>>
>> Hi all,
>>
>> I'm creating a rest interface and I'd like to do something like:
>>
>> URL: /pets/default/api/pets
>> RESULT: [
>> {name: 'Ramo',
>> animal: 'dog',
>> owner: 'http://server:port/pets/default/api/owners/15'}
>> ]
>>
>> but instead it keeps returning in the format of
>> [
>> {name: 'Ramo',
>> animal: 'dog',
>> owner: 15}
>> ]
>>
>> I'm using the 'format' parameter on the field 'owner' of the table 'pet', 
>> but when rendering json, it doesn't seem to listen to it. Is it possible to 
>> do so? Am I doing something wrong?
>>
>>

-- 

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


Reply via email to