Good night

1) Another problem that i have is that the webgrid show me the id's of the
diagnostico_referencia table. I need that it shows the name of the
'diagnostico' table.  It could be done with a join, but it is intended to be
deploy in GAE. I understand that GAE does not work with joins.

2) I am not sure if i am expressing  well. I need that the crud page
inheritance
the foreing key from the master page.  In order that the user has not to
write the referencia.id value in the crud page


Thansk for any advice.
Napoleon

db.define_table('diagnostico',
    Field('name','string')

 )

db.define_table('referencia',
    Field('fecha_remision',' datetime')
    .....
  )

db.define_table('diagnostico_referencia',
    Field('diagnostico',db.diagnostico),
    Field('referencia',db.referencia)
 )


# The controler show the fields of 'referencia' . I use the referencia.id to
filter to grid.datasource

   form = sqlform(db.referencia.id = = referencia_id).select()
   ....

    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())




On Mon, Nov 15, 2010 at 6:15 PM, Napoleon Moreno <[email protected]>wrote:

> Good afternoon
>
> I am not sure if i am expressing  well. I need that the crud page inheritance
> the foreing key from the master page.  In order that the user has not to
> write the referencia.id value in the crud page
>
> Thanks
>
>
> On Mon, Nov 15, 2010 at 6:02 PM, Napoleon Moreno <[email protected]>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 <[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.id value 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
>>>>
>>>
>>>
>>
>

Reply via email to