That should make no difference

On Oct 1, 11:29 pm, Mariano Reingart <[email protected]> wrote:
> On Fri, Oct 1, 2010 at 3:40 PM, Ivan Matveev <[email protected]> wrote:
>
> > 2010/10/1 mdipierro <[email protected]>
>
> >> keyed tables are only partially supported. Perhaps user Denes can say
> >> more about that. For now here is a quick hack that should work:
>
> > Thank you for fast reply.
>
> >> db.define_table('cars',
> >>    Field('car_id','integer'),
> >>    Field('model_id',
> >> 'integer',requires=IS_IN_DB(db,'car_models.model_id','%
> >> (model_name)s')),
> >>    Field('note','text'),
> >>    primarykey=['car_id'],
> >>    migrate=False
> >> )
>
> > Thats what I'm using now.  Some nice tools (like WebGrid) don't work  this
> > way. Maybe I'l try to fix WebGrid.
>
> Did you try string notation for references?
>
> db.define_table('cars',
>    Field('car_id','integer'),
>    Field('model_id', "reference car_models.model_id"),
>    Field('note','text'),
>    primarykey=['car_id'],
>    migrate=False
> )
>
> Anyway, if you are using single-field integer primary keys, i think
> you may try "id" field type:
>
> db.define_table('car_models',
>    Field('model_id','id'),
>    Field('model_name','string'),
>    migrate=False
> )
>
> db.define_table('cars',
>    Field('car_id','id'),
>    Field('model_id','reference car_models'),
>    Field('note','text'),
>    migrate=False
> )
>
> Regards,
>
> Mariano Reingarthttp://www.sistemasagiles.com.arhttp://reingart.blogspot.com

Reply via email to