I don't understand how represent would be of help. Could you show
that?

On Feb 7, 11:43 am, Richard Vézina <[email protected]>
wrote:
> Why not use represent?
>
> http://web2py.com/books/default/chapter/29/6?search=represent#Record-...
>
> Richard
>
>
>
>
>
>
>
> On Tue, Feb 7, 2012 at 12:37 PM, shartha <[email protected]> wrote:
> > Hello.
>
> > I have this model:
> > db = DAL('sqlite://storage.sqlite')
>
> > db.define_table('customers',
> >    Field('name'),
> >    Field('age'),
> >    format = '%(name)s'
> > )
>
> > db.define_table('purchases',
> >    Field('name',db.customers),
> >    Field('cart')
> > )
>
> > db.purchases.name.requires = IS_IN_DB(db,db.customers,'%(name)s')
>
> > The table customers has these values in it:
> > (Jack,17)
> > (John,23)
>
> > The table purchases has these values in it:
> > (Jack, CD)
> > (John, DVD)
>
> > Now in my controller if I use the following query:
> > query = db(db.purchases.id>0).select
> > return (purchases = query)
>
> > Now if in my view, I loop through purchases to type their name
> > property, e.g. purchases[0].name, the id of the person from the
> > customers table will be returned. What should I use alternatively to
> > get the actual name of the person, e.g. Jack, or John? I don't want to
> > have another query for that.

Reply via email to