auth_user_rows = db().select(db.auth_user.id)

make a set :

auth_user_set = ((db.auth_user.id ==  rows.first().id)|(db.auth_user.id ==
 rows.last().id))

IS_IN_DB(auth_user_set,...)

Richard

On Mon, May 7, 2012 at 4:37 PM, Jim Steil <[email protected]> wrote:

> Hi
>
> I am having trouble getting my list to display the way I want it to.
>
> Given the following definition:
>
> -----------------------
> helpdeskTech = db.define_table('helpdeskTech'**,
>    Field('helpdeskTechId', 'id', readable=False),
>    Field('helpdeskId', db.helpdesk, required=True, label='Helpdesk'),
>    Field('userId', db.auth_user, required=True, label='User'),
>    format='%(userId.lastFirst)s')
> helpdeskTech.helpdeskId.**requires = IS_IN_DB(db, db.helpdesk,
>                                            '%(name)s',
>                                            zero='...choose...')
> helpdeskTech.userId.requires = IS_IN_DB(db, db.auth_user,
>                                        '%(lastFirst)s',
>                                        zero='...choose...')
> helpdeskTech['_plural'] = 'Technicians'
>
> ticket = db.define_table('ticket',
>    Field('ticketId', 'id', readable=False),
>    Field('helpdeskId', db.helpdesk, required=True, label='Helpdesk'),
>    Field('name', length=100, required=True),
>    Field('description', 'text'),
>    Field('createdOn', 'date', label='Created'),
>    Field('createdBy', db.auth_user, required=True, label='Creator'),
>    Field('assignedTo', db.helpdeskTech, label='Assigned To'),
>    Field('priority', length=10, required=True),
>    Field('status', length=10, required=True),
>    format='%(name)s')
> ticket.helpdeskId.requires = IS_IN_DB(db, db.helpdesk,
>                                            '%(name)s',
>                                            zero='...choose...')
> ticket.name.requires = IS_NOT_EMPTY()
> ticket.createdOn.requires = IS_DATE('%m/%d/%Y')
> ticket.createdBy.requires = IS_IN_DB(db, db.auth_user,
>                                     '%(lastFirst)s',
>                                     zero='...choose...')
> ticket.assignedTo.requires = IS_NULL_OR(IS_IN_DB(db, db.helpdeskTech,
>                                                 zero='...choose...'))
> -----------------------
>
> I want my IS_IN_DB validator in the last line to display the last name and
> first name from the auth_user table.
>
> But, what I'm getting is the helpdeskTechId field displaying.
>
> I'm wondering how I can refer back to the auth_user table to get the names
> to display in the dropdown instead of the helpdeskTechId without
> custom-coding the view.
>
> Thoughts?
>
>    -Jim
>
>
>
>

Reply via email to