The "id" field is not writable in SQLFORMs, so the grid/SQLFORM do not
include that field in update SQL queries. Does the "id" field actually
appear as writable in your forms? What happens if you just do
SQLFORM.grid(db.amc_master) without specifying the fields list or setting
any of the readable/writable attributes?
On Wednesday, May 24, 2017 at 5:08:56 AM UTC-4, T.R.Rajkumar wrote:
>
> I have this in model.
> db.define_table('amc_master',
> Field('amcno', type='string',length=10,
> required='True',notnull='True',requires=IS_LENGTH(10)),
> Field('unitid',type='string',length=3,notnull='True'),
> Field('amcdesc',
> type='string',length=512,required='True',notnull='True'),
> Field('estval', type='decimal(18,2)'),
> Field('supcflg', type='string', length=1),
> Field('supcval',type='decimal(18,2)'),
> Field('netestval',type='decimal(18,2)'),
> Field('bidmethod',type='string',length=3),
> Field('capbud',type='string',length=1),
> Field('amcmod',type='string',length=3),
> Field('lrrflg',type='string',length=1),
> Field('insflg',type='string',length=1),
> Field('stflg',type='string',length=1),
> Field('phwflg',type='string',length=1),
> Field('contyp',type='string',length=3),
> Field('rfact',type='decimal(18,2)'),
> Field('qfact',type='decimal(18,2)'),
> Field('emdamt',type='decimal(18,2)'),
> Field('doccharge',type='decimal(18,2)'),
> Field('divn',type='string',length=3),
> Field('subdivn',type='string',length=2),
> Field('cflg',type='string',length=1),
> Field('statflg',type='string',length=3),
> Field('appauthority',type='string',length=16),
> Field('accappddt',type='datetime'),
> Field('iewappddt',type='datetime'),
> Field('complndays',type='integer'),
> Field('examcno',type='string',length=10),
> Field('consoldamcstr',type='string',length=70),
> Field('isconsold',type='string',length=1),
> Field('estonprovn',type='decimal(18,2)'),
> Field('totest',type='decimal(18,2)'),
>
> Field('update_uid','string',length=6,required='True',notnull='True'),
>
> Field('update_dt','datetime',required='True',notnull='True')
> )
>
> in controller i have this
>
> def newamcmaster():
> list_of_fields =
> [db.amc_master.amcdesc,db.amc_master.amcmod,db.amc_master.complndays]
> [setattr(f, 'readable', False) for f in db.amc_master if f.name not
> in ['amcdesc','amcmod','complndays']]
> [setattr(f, 'writable', False) for f in db.amc_master if f.name not
> in ['amcdesc','amcmod','complndays']]
> grid =
> SQLFORM.grid(db.amc_master,user_signature=False,fields=list_of_fields,oncreate=create_new_amc)
> return locals()
>
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.