Hi, I'm not sure, but I think Napoleon wants to save the id key of the 'master table' into the master_id field of the 'detail' table. I'm not sure how it works with crud. I would suggest that you use SQLFORM and set the field after form.accepts. Take a look at this link:
http://www.web2pyslices.com/main/slices/take_slice/102 This is a short-cut way of linking tables, but notice how the id is set. Hope this helps. -D On Nov 15, 11:49 pm, "mr.freeze" <nat...@freezable.com> wrote: > Sorry, I don't fully understand. You can email your app (with any > personal data removed) and I will take a closer look. > > On Nov 15, 5:02 pm, Napoleon Moreno <napoleo...@gmail.com> wrote: > > > I am doing that. but the crud form does not the key value from the master > > table. ( or master page ). The user has to input the referencia value in the > > crud page. > > > db.define_table('referencia', > > Field('fecha_remision',' > > > > datetime') > > > ) > > > > db.define_table('diagnostico_referencia', > > > Field('diagnostico',db.diagnostico), > > > Field('referencia',db.referencia) > > > ) > > > > in the controler > > > .... > > > > grid = webgrid.WebGrid(crud) > > > grid.enabled_rows = ['add_links'] > > > grid.action_links = ['delete'] > > > grid.action_headers = [] > > > grid.crud_function = 'diagnostico_referencia' > > > > crud.settings.controller = 'default' > > > grid.datasource = > > > db(db.diagnostico_referencia.referencia==referencia_id).select() > > > return dict(form=form, grid=grid(),referencia=referencia_id) > > > > def diagnostico_referencia(): > > > crud.settings[request.args(0)+'_next'] = URL(r=request,f='referencia') > > > return dict(form=crud()) > > > > Is it posible that the form in diagnostico_referencia get the > > > referencia.id value from the controler in the addition form? > > > On Mon, Nov 15, 2010 at 5:59 PM, Napoleon Moreno > > <napoleo...@gmail.com>wrote: > > > > Thansk for your answer > > > > I am doing that. but the crud form does not the key value from the master > > > table. ( or master page ) > > > > This is my code > > > > db.define_table('referencia', > > > Field('fecha_remision','datetime') > > > ) > > > > db.define_table('diagnostico_referencia', > > > Field('diagnostico',db.diagnostico), > > > Field('referencia',db.referencia) > > > ) > > > > in the controler > > > .... > > > > grid = webgrid.WebGrid(crud) > > > grid.enabled_rows = ['add_links'] > > > grid.action_links = ['delete'] > > > grid.action_headers = [] > > > grid.crud_function = 'diagnostico_referencia' > > > > crud.settings.controller = 'default' > > > grid.datasource = > > > db(db.diagnostico_referencia.referencia==referencia_id).select() > > > return dict(form=form, grid=grid(),referencia=referencia_id) > > > > def diagnostico_referencia(): > > > crud.settings[request.args(0)+'_next'] = URL(r=request,f='referencia') > > > return dict(form=crud()) > > > > Is it posible that the form in diagnostico_referencia the > > > referencia.idvalue from the controler in the addition form? > > > > On Mon, Nov 15, 2010 at 5:26 PM, mr.freeze <nat...@freezable.com> wrote: > > > >> You need to expose crud through a controller. In default.py, put this: > > > >> def data(): > > >> return dict(form=crud()) > > > >> Then set the grid accordingly: > > >> grid.crud_function = 'data' > > > >> On Nov 15, 4:15 pm, Napoleon Moreno <napoleo...@gmail.com> wrote: > > >> > Good afternoon > > > >> > I am trying to use webgrid in a master- detail form. > > > >> > But i can't find the way to link the crud with the master form. > > > >> > any body knows how to do it? > > > >> > Thansk > >