Re: [web2py] record representation using a non-id column?

2011-07-20 Thread Johann Spies
On 20 July 2011 14:09, Johann Spies  wrote:

>
> I use this:
>
>
> db.define_table('akb_doccenter_location',
>
> Field('location'))
>
>
Apologies, I did not complete the message before sending: the model includes
a Field(uuid),  obviously.

Regards
Johann


-- 
 May grace and peace be yours in abundance through the full knowledge of God
and of Jesus our Lord!  His divine power has given us everything we need for
life and godliness through the full knowledge of the one who called us by
his own glory and excellence.
2 Pet. 1:2b,3a


Re: [web2py] record representation using a non-id column?

2011-07-20 Thread Johann Spies
 On 9 July 2011 03:47, niknok  wrote:

> **
> I have another unique column in my table that I would like to use as index
> for record representation.  How do I tell web2py to use another index?
>
> Ttrying to use like:
> db.mytable.thisfield.represent = lambda id: db.other(myidx).thatfield
>

I use this:


db.define_table('akb_doccenter_location',

Field('location'))

db.akb_doccenter.location.represent = lambda uuid: db(
db.akb_doccenter_location.uuid==uuid).select(
db.akb_doccenter_location.location).first()['location']


-- 
 May grace and peace be yours in abundance through the full knowledge of God
and of Jesus our Lord!  His divine power has given us everything we need for
life and godliness through the full knowledge of the one who called us by
his own glory and excellence.
2 Pet. 1:2b,3a


[web2py] record representation using a non-id column?

2011-07-08 Thread niknok
I have another unique column in my table that I would like to use as
index for record representation.  How do I tell web2py to use another
index?

Ttrying to use like:
db.mytable.thisfield.represent = lambda id:
db.other(myidx).thatfield