Now I am even more confused :)

Sorry for being a nagging person. 

Why does SQLFORM.grid display the name (as I want) in the setupid column, but 
not display the name on  Size ID or hostgroup. ?


Id
Setup ID
Size ID
Lun ID
Host Group

1
AN10 on frame 520-1
2
2
7
ViewEditDelete
2
AN10 on frame 520-1
2
3
7
ViewEditDelete
3
AN10 on frame 520-1
2
4
7
ViewEditDelete

The database table


db.define_table('lvstorage',

    Field('setup_id', db.setup,
          default=1,
          label=T('Setup ID')),
    Field('lvsize_id', db.lvsize,
          default=2,
          label=T('Size ID')),
    Field('lunid', type='integer',
          default=2,
          label=T('Lun ID')),
    Field('storagemap_id', db.storagemap,
          default=1,
          label=T('Host Group')),
    Field('created_on','datetime',default=request.now,
          label=T('Created On'),writable=False,readable=False),
    Field('modified_on','datetime',default=request.now,
          label=T('Modified On'),writable=False,readable=False,
          update=request.now),
    migrate=settings.migrate)

# Table rules
db.lvstorage.setup_id.requires = IS_IN_DB(db, 'setup.id', 'setup.setupname')
db.lvstorage.lvsize_id.requires = IS_IN_DB(db, 'lvsize.id', 'lvsize.sizename')
db.lvstorage.storagemap_id.requires = IS_IN_DB(db, 'storagemap.id', 
'storagemap.mapping')








Controller

 left = 
(db.lvsize.on(db.lvstorage.lvsize_id==db.lvsize.id),db.storagemap.on(db.lvstorage.storagemap_id==db.storagemap.id),db.setup.on(db.lvstorage.setup_id==db.setup.id))
    
 query = db.lvstorage.setup_id==usedsetupid
    grid = SQLFORM.grid(query,
                        left = left,
                        csv = False
                        )
 
    return dict(usedsetupid=usedsetupid, grid=grid)



> Now I think of it, you do not need to do a redirect because it creates its
> own page based on the called page.
> 
> Its just that the submit does not do anything.
> 
> > SQLFORM.grid does not actually add the records automatically. It just
> > calls the grid controller with args action/table.
> > 
> > You have to do something like:
> >     if request.args(0) in ("edit", "new"):
> >         redirect(URL("edit.html", args=[request.args(1),
> > 
> > request.args(2)])
> > 
> > On Nov 2, 9:15 am, Mike Veltman <mike.velt...@gmail.com> wrote:
> > > > are you able to see the form? or are you getting the "not authorized
> > > > message?"
> > > > 
> > > > you can set user_signature=False or ensure that user is logged in.
> > > 
> > > Thanks for the reaction. But no the form is generated perfectly. And
> > > the user is logged in.
> > > 
> > > > On Wed, Nov 2, 2011 at 6:50 AM, Mike Veltman <mike.velt...@gmail.com>
> 
> wrote:
> > > > > I have
> > > > > grid =
> > > > > 
> > > > > SQLFORM.grid(query=db.lvstorage.setup_id==usedsetupid,csv=False,det
> > > > > ai ls=T rue,searchable=True)
> > > > > 
> > > > > That creates a form with the records with a add button. But when I
> > > > > use add I
> > > > > get the next screen but the record is not added. What do I miss ?
> > > > > 
> > > > > Btw is the same setup with a query possible with SQLFORM.smartgrid
> > > > > ?
> > > > > 
> > > > > With regards,
> > > > > Mike Veltman
> > > 
> > > With regards,
> > > Mike Veltman
> 
> With regards,
> Mike Veltman

With regards,
Mike Veltman


Reply via email to