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 <[email protected]>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 <[email protected]> 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 <[email protected]> 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
>>
>
>