Hi Napolean

I have looked at your app and I did not understand it very well,  but
I hope you don't mind that I will try to give you some advice anyway
(even though it might not be so useful!).

It seems that you are going from one view to another without a good
way of passing the ids.  For example you are doing this:

  referencia_id = session.referencia_id

Why not use the url and pick up the id with request.args(0)?

How do you find the patient info again? Why not try something like
this in your form...

   record = db.table(request.args(0)) or redirect(URL('index'))

The general advice I would give you is:

1. Try to it working in one controller and view first of all. You can
display more than one form in the view. Keep self-submitting the form
to the same controller until you see what you expect.

2. Either use the url to pass the id,  or place as a hidden field on
your forms -- see the book.

3. Use SQLFORM instead of crud whenever things start looking
complex.

4. Test the variables in your controller. e.g. try putting: print '--
whatever-here--' in your controller and then check the value on the
web2py commandline.

5. Once you have everyone working,  you can then figure out the best
UI.  You do not necessarily need to split everything across different
views. You could try for example using jQuery to show and hide forms
when you need them.

Finally, just a small point, take out 'welcome' from all the menu.py
links.  It is not necessary and it will make things easier for you
when you rename the app.

I am sure that everyone in the group would love to give detailed
advice when they can, and others may tell you more,  but quite
honestly it is too much to ask that people will find enough time to
download, review and debug entire apps for you, (please do not be
offended, I am just stating a fact!).

Best wishes,  David


On Nov 17, 2:24 pm, Napoleon Moreno <napoleo...@gmail.com> 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 <napoleo...@gmail.com>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 
> > <napoleo...@gmail.com>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 <villa...@gmail.com> 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" <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
>
>

Reply via email to