This should tell web2py to display the name instead of the id in
references

db.define_table('account', ..., format='%(name)s')

You can find more info in the book's chapter 6.5, "Record
representation"

On 7 mar, 20:52, Edward Shave <ed.sh...@eshavefindings.co.uk> wrote:
> *I have the following table definition...*
> *
> *
> *db.define_table('account',
> *
> *    Field('name'),*
> *    Field('transfer_acc','reference account'),
> *
> *    )*
> *
> db.account.name.requires = IS_NOT_EMPTY()
> *
> *
> db.account.transfer_acc.requires = IS_IN_DB(db,db.account.id,'%(name)s')
>
> ...Note the table contains a self referencing field.
>
> *
> *The reference field displays the referenced id in sqltable... What is best
> way to replace id with name of account? *

Reply via email to