I found the answer in the book , like is usual
db.define_table('diagnostico',
Field('name','string'),format='%(name)s'
)
It shows the name in every place where i have the diagnostico.id. I got my
app running.
Thanks everybody!
On Wed, Nov 17, 2010 at 9:24 AM, Napoleon Moreno <[email protected]>wrote:
> I am sorry for insist in this but it is driving me crazy.
>
> If i can not use a join in GAE. How can i show the name of 'diagnostico'
> table in an webgrid base on 'diagnostico_referencia' table. I tried with
> webgrid and crud and it always show me the id's of the
> 'diagnostico_referencia' table.
>
> Any advice about it?
>
>
>
> On Wed, Nov 17, 2010 at 6:57 AM, Napoleon Moreno <[email protected]>wrote:
>
>> Good day
>>
>> The webgrid is showing the fields of 'diagnostico_referencia' table. I
>> need that it shows the name field of the 'Diagnostico' table. I can not find
>> a way to do it. It suppose to be used in GAE.
>>
>> Any advice about it
>> Thanks a lot for your help
>>
>>
>> On Wed, Nov 17, 2010 at 6:52 AM, Napoleon Moreno <[email protected]>wrote:
>>
>>> Hi Villas
>>>
>>> It is that i need. Apparently there is not a way to do it with a crud. I
>>> could use a sqlform.
>>>
>>> Thanks!
>>>
>>>
>>> On Mon, Nov 15, 2010 at 7:16 PM, villas <[email protected]> wrote:
>>>
>>>> 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" <[email protected]> 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 <[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.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
>>>> >
>>>> >
>>>>
>>>
>>>
>>
>