[web2py] Re: SQLFORM.grid representation
While it could be a bug, and seems to be similar to another reported issue: http://groups.google.com/group/web2py/browse_thread/thread/aa5fa98a74e9364f# there has been no formal acknowledgement of it in .grid or .smartgrid, nor have there been any defect tickets raised. You can also see it in a screenshot that Bruno Rocha posted recently: http://www.diigo.com/item/image/121xl/3iob It leads me to think that there may be an alternative method, particularly when 1.99.1. is due shortly. Cheers, (apologies if there are a number of similar posts from me. The first 2 seemed to be accepted, but haven't appeared yet. This is posted using a different account) On Sep 14, 12:11 am, Jim Steil j...@qlf.com wrote: Is it possible that this is a bug? (I don't have the expertise/confidence to say it is definitely a bug). I duplicated your example and can reproduce your results. But, if I go through appadmin and list out my table the owner name does appear. -Jim On 9/12/2011 9:51 PM, Simon Ashley wrote: Have a Model as follows: from gluon.tools import Auth auth=Auth(db) auth.define_tables() db.define_table('person',Field('name'),format='%(name)s') db.define_table('dog',Field('name'),Field('owner',db.person)) db.dog.owner.requires = IS_IN_DB(db, 'person.id', db.person._format) and a controller: def index(): db.dog.id.readable=False fields = (db.dog.id, db.dog.name, db.dog.owner) table = SQLFORM.grid(db.dog, fields) return dict(table=table) Main issue: the grid returns the id rather than the name for the owner. Edit and view both return the name (as expected). Is there a problem with the model/ controller syntax? Side issue: In the controller, fields line, if db.dog.id is left out, the grid returns an id ticket error. Traceback (most recent call last): File gluon/restricted.py, line 194, in restricted File C:/web2py/applications/pt2/controllers/dogs.py, line 7, in module File gluon/globals.py, line 145, inlambda File C:/web2py/applications/pt2/controllers/dogs.py, line 4, in index File gluon/sqlhtml.py, line 1647, in grid File gluon/dal.py, line 3835, in __getitem__ KeyError: 'id' This occurs with or without the second line (... readable=False) commented out. Wanted to show the id in edit and view forms but not in the grid. Can this be achieved?
[web2py] Re: SQLFORM.grid representation
While it looks like a bug, it may not be implemented in the new .grid or .smartgrid. There is a posting that may imply this http://groups.google.com/group/web2py/browse_thread/thread/aa5fa98a74e9364f and certainly in image examples posted by Bruno Rocha http://www.diigo.com/item/image/121xl/3iob it doesn't look like its been implemented. A little it odd seeing that 1.99.1 is due for release shortly. cheers, On Sep 14, 12:11 am, Jim Steil j...@qlf.com wrote: Is it possible that this is a bug? (I don't have the expertise/confidence to say it is definitely a bug). I duplicated your example and can reproduce your results. But, if I go through appadmin and list out my table the owner name does appear. -Jim On 9/12/2011 9:51 PM, Simon Ashley wrote: Have a Model as follows: from gluon.tools import Auth auth=Auth(db) auth.define_tables() db.define_table('person',Field('name'),format='%(name)s') db.define_table('dog',Field('name'),Field('owner',db.person)) db.dog.owner.requires = IS_IN_DB(db, 'person.id', db.person._format) and a controller: def index(): db.dog.id.readable=False fields = (db.dog.id, db.dog.name, db.dog.owner) table = SQLFORM.grid(db.dog, fields) return dict(table=table) Main issue: the grid returns the id rather than the name for the owner. Edit and view both return the name (as expected). Is there a problem with the model/ controller syntax? Side issue: In the controller, fields line, if db.dog.id is left out, the grid returns an id ticket error. Traceback (most recent call last): File gluon/restricted.py, line 194, in restricted File C:/web2py/applications/pt2/controllers/dogs.py, line 7, in module File gluon/globals.py, line 145, inlambda File C:/web2py/applications/pt2/controllers/dogs.py, line 4, in index File gluon/sqlhtml.py, line 1647, in grid File gluon/dal.py, line 3835, in __getitem__ KeyError: 'id' This occurs with or without the second line (... readable=False) commented out. Wanted to show the id in edit and view forms but not in the grid. Can this be achieved?
Re: [web2py] Re: SQLFORM.grid representation
On 14 September 2011 10:47, Simon Ashley simonashle...@gmail.com wrote: While it looks like a bug, it may not be implemented in the new .grid or .smartgrid. There is a posting that may imply this http://groups.google.com/group/web2py/browse_thread/thread/aa5fa98a74e9364f and certainly in image examples posted by Bruno Rocha http://www.diigo.com/item/image/121xl/3iob it doesn't look like its been implemented. A little it odd seeing that 1.99.1 is due for release shortly. I certainly hope that the problems involving SQLFORM.grid/smartgid regarding representation and the handling of all the types will be solved before the release. Regards Johann -- May grace and peace be yours in abundance through the full knowledge of God and of Jesus our Lord! His divine power has given us everything we need for life and godliness through the full knowledge of the one who called us by his own glory and excellence. 2 Pet. 1:2b,3a
Re: [web2py] Re: SQLFORM.grid representation
Perhaps you want to use columns instead of fields. replace your controller with this: def index(): columns = ['dog.name', 'dog.owner'] table = SQLFORM.grid(db.dog, columns=columns) return dict(table=table) columns affect the grid column displaying only. Pass to column the field you want to display, no need to put readable=False. 2011/9/14 Simon Ashley gregs...@gmail.com While it could be a bug, and seems to be similar to another reported issue: http://groups.google.com/group/web2py/browse_thread/thread/aa5fa98a74e9364f# there has been no formal acknowledgement of it in .grid or .smartgrid, nor have there been any defect tickets raised. You can also see it in a screenshot that Bruno Rocha posted recently: http://www.diigo.com/item/image/121xl/3iob It leads me to think that there may be an alternative method, particularly when 1.99.1. is due shortly. Cheers, (apologies if there are a number of similar posts from me. The first 2 seemed to be accepted, but haven't appeared yet. This is posted using a different account) On Sep 14, 12:11 am, Jim Steil j...@qlf.com wrote: Is it possible that this is a bug? (I don't have the expertise/confidence to say it is definitely a bug).I duplicated your example and can reproduce your results. But, if I go through appadmin and list out my table the owner name does appear. -Jim On 9/12/2011 9:51 PM, Simon Ashley wrote: Have a Model as follows: from gluon.tools import Auth auth=Auth(db) auth.define_tables() db.define_table('person',Field('name'),format='%(name)s') db.define_table('dog',Field('name'),Field('owner',db.person)) db.dog.owner.requires = IS_IN_DB(db, 'person.id', db.person._format) and a controller: def index(): db.dog.id.readable=False fields = (db.dog.id, db.dog.name, db.dog.owner) table = SQLFORM.grid(db.dog, fields) return dict(table=table) Main issue: the grid returns the id rather than the name for the owner. Edit and view both return the name (as expected). Is there a problem with the model/ controller syntax? Side issue: In the controller, fields line, if db.dog.id is left out, the grid returns an id ticket error. Traceback (most recent call last): File gluon/restricted.py, line 194, in restricted File C:/web2py/applications/pt2/controllers/dogs.py, line 7, in module File gluon/globals.py, line 145, inlambda File C:/web2py/applications/pt2/controllers/dogs.py, line 4, in index File gluon/sqlhtml.py, line 1647, in grid File gluon/dal.py, line 3835, in __getitem__ KeyError: 'id' This occurs with or without the second line (... readable=False) commented out. Wanted to show the id in edit and view forms but not in the grid. Can this be achieved? -- http://martin.tecnodoc.com.ar
Re: [web2py] Re: SQLFORM.grid representation
Hi martín, And with powergrid? -- Enviado desde mi teléfono Android con K-9 Mail. Disculpa mi brevedad Martín Mulone mulone.mar...@gmail.com escribió: Perhaps you want to use columns instead of fields. replace your controller with this: def index(): columns = ['dog.name', 'dog.owner'] table = SQLFORM.grid(db.dog, columns=columns) return dict(table=table) columns affect the grid column displaying only. Pass to column the field you want to display, no need to put readable=False. 2011/9/14 Simon Ashley gregs...@gmail.com While it could be a bug, and seems to be similar to another reported issue: http://groups.google.com/group/web2py/browse_thread/thread/aa5fa98a74e9364f# there has been no formal acknowledgement of it in .grid or .smartgrid, nor have there been any defect tickets raised. You can also see it in a screenshot that Bruno Rocha posted recently: http://www.diigo.com/item/image/121xl/3iob It leads me to think that there may be an alternative method, particularly when 1.99.1. is due shortly. Cheers, (apologies if there are a number of similar posts from me. The first 2 seemed to be accepted, but haven't appeared yet. This is posted using a different account) On Sep 14, 12:11 am, Jim Steil j...@qlf.com wrote: Is it possible that this is a bug? (I don't have the expertise/confidence to say it is definitely a bug).I duplicated your example and can reproduce your results. But, if I go through appadmin and list out my table the owner name does appear. -Jim On 9/12/2011 9:51 PM, Simon Ashley wrote: Have a Model as follows: from gluon.tools import Auth auth=Auth(db) auth.define_tables() db.define_table('person',Field('name'),format='%(name)s') db.define_table('dog',Field('name'),Field('owner',db.person)) db.dog.owner.requires = IS_IN_DB(db, 'person.id', db.person._format) and a controller: def index(): db.dog.id.readable=False fields = (db.dog.id, db.dog.name, db.dog.owner) table = SQLFORM.grid(db.dog, fields) return dict(table=table) Main issue: the grid returns the id rather than the name for the owner. Edit and view both return the name (as expected). Is there a problem with the model/ controller syntax? Side issue: In the controller, fields line, if db.dog.id is left out, the grid returns an id ticket error. Traceback (most recent call last): File gluon/restricted.py, line 194, in restricted File C:/web2py/applications/pt2/controllers/dogs.py, line 7, in module File gluon/globals.py, line 145, inlambda File C:/web2py/applications/pt2/controllers/dogs.py, line 4, in index File gluon/sqlhtml.py, line 1647, in grid File gluon/dal.py, line 3835, in __getitem__ KeyError: 'id' This occurs with or without the second line (... readable=False) commented out. Wanted to show the id in edit and view forms but not in the grid. Can this be achieved? -- http://martin.tecnodoc.com.ar
Re: [web2py] Re: SQLFORM.grid representation
On Wed, Sep 14, 2011 at 1:11 PM, roberto...@gmail.com roberto...@gmail.comwrote: ** Hi martín, And with powergrid? PowerGrid is a bit different, because its data is based in JSON callback. My initial view was that users may code their own JSON callback to work with grid. Bit it is in my TODO to enable representation of records in the default callback. take a look: https://bitbucket.org/rochacbruno/powergrid/src/9b1d2389235c/modules/plugin_PowerGrid/CallBack.py#cl-201 Any takers to send a patch?
[web2py] Re: SQLFORM.grid representation
Just tried that, but it still returns the Id .. 1. it just returns a ticket if On Sep 15, 12:57 am, Martín Mulone mulone.mar...@gmail.com wrote: Perhaps you want to use columns instead of fields. replace your controller with this: def index(): columns = ['dog.name', 'dog.owner'] table = SQLFORM.grid(db.dog, columns=columns) return dict(table=table) columns affect the grid column displaying only. Pass to column the field you want to display, no need to put readable=False. 2011/9/14 Simon Ashley gregs...@gmail.com While it could be a bug, and seems to be similar to another reported issue: http://groups.google.com/group/web2py/browse_thread/thread/aa5fa98a74... there has been no formal acknowledgement of it in .grid or .smartgrid, nor have there been any defect tickets raised. You can also see it in a screenshot that Bruno Rocha posted recently: http://www.diigo.com/item/image/121xl/3iob It leads me to think that there may be an alternative method, particularly when 1.99.1. is due shortly. Cheers, (apologies if there are a number of similar posts from me. The first 2 seemed to be accepted, but haven't appeared yet. This is posted using a different account) On Sep 14, 12:11 am, Jim Steil j...@qlf.com wrote: Is it possible that this is a bug? (I don't have the expertise/confidence to say it is definitely a bug). I duplicated your example and can reproduce your results. But, if I go through appadmin and list out my table the owner name does appear. -Jim On 9/12/2011 9:51 PM, Simon Ashley wrote: Have a Model as follows: from gluon.tools import Auth auth=Auth(db) auth.define_tables() db.define_table('person',Field('name'),format='%(name)s') db.define_table('dog',Field('name'),Field('owner',db.person)) db.dog.owner.requires = IS_IN_DB(db, 'person.id', db.person._format) and a controller: def index(): db.dog.id.readable=False fields = (db.dog.id, db.dog.name, db.dog.owner) table = SQLFORM.grid(db.dog, fields) return dict(table=table) Main issue: the grid returns the id rather than the name for the owner. Edit and view both return the name (as expected). Is there a problem with the model/ controller syntax? Side issue: In the controller, fields line, if db.dog.id is left out, the grid returns an id ticket error. Traceback (most recent call last): File gluon/restricted.py, line 194, in restricted File C:/web2py/applications/pt2/controllers/dogs.py, line 7, in module File gluon/globals.py, line 145, inlambda File C:/web2py/applications/pt2/controllers/dogs.py, line 4, in index File gluon/sqlhtml.py, line 1647, in grid File gluon/dal.py, line 3835, in __getitem__ KeyError: 'id' This occurs with or without the second line (... readable=False) commented out. Wanted to show the id in edit and view forms but not in the grid. Can this be achieved? -- http://martin.tecnodoc.com.ar