Jim,

Yeah, that was first thing I tried but grid doesn't understand it like
form.


On Nov 14, 5:40 pm, Jim Steil <[email protected]> wrote:
> Here's what I would do.
>
> (not tested)
>
> db.define_table('Model',
>      Field('Name'),
>      Field('Unit'),
>      format='%(name)s')
>
>      -Jim
>
> On 11/14/2011 4:55 PM, Omi Chiba wrote:
>
>
>
>
>
>
>
> > I want to show the reference field value ('Name' in Model table) on
> > the grid instead of the original value (Model_ID in Product table).
>
> > Is there easy way to do it ?
>
> > Controller
> > -----------------------
> > def admin():
> >      db.Product.id.readable = False
> >      products =
> > SQLFORM.grid(db.Product,create=False,editable=False,deletable=False,
> > paginate=10)
> >      return dict(products = products)
> > -----------------------------------------------------
>
> > Model
> > --------------------------
> > db.define_table('Model',
> >      Field('Name'),
> >      Field('Unit'))
>
> > db.define_table('Product',
> >      Field('Part_Number',label='Part Number'),
> >      Field('Model_ID', db.Model ,label='Model Number'),
> >      Field('List_Price', 'decimal(13,2)' ,label='List Price'),
> >      Field('FOB', 'decimal(13,2)' ,label='FOB'),
> >      Field('Weight', 'decimal(13,2)' ,label='Weight'))
> > --------------------------------------------------

Reply via email to