# Hidden fields in grid and edit/view form.
db.opt.canceled_on.readable = False
db.opt.canceled_by.readable = False
db.opt.cancel_approved_by.readable = False
query = ((db.opt.is_active == True) & (db.opt.opt_cat_id == db.opt_cat.id))
grid = SQLFORM.grid(
query,
csv=False,
deletable=False,
details=False,
fields=[
db.opt.id,
db.opt.name,
db.opt_cat.name,
db.opt_cat.name_en,
],
headers={'opt_cat.name': T('Category'), 'opt_cat.name_en': T('Category')},
links=[
lambda row: A(
SPAN(T('Delete'), _class='buttontext button', _title='Delete'),
_href=URL('get_approval', args=[row.opt.id], user_signature=True),
_class='button btn btn-default btn-secondary',
),
],
maxtextlength=GRID_COL_LEN_FOR_TEXT,
ondelete=on_delete, # Grid only.
onvalidation=on_validation, # Form only.
orderby=db.opt.name,
paginate=session.auth.user.pagination,
# represent_none='', # Grid and view form only.
)
ERROR:web2py:Traceback (most recent call last):
File "C:\web2py\gluon\packages\dal\pydal\objects.py", line 107, in __getattr__
return self.__getitem__(k)
File "C:\web2py\gluon\packages\dal\pydal\objects.py", line 94, in __getitem__
raise KeyError(key)
KeyError: 'opt'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\web2py\gluon\restricted.py", line 219, in restricted
exec(ccode, environment)
File "c:\web2py\applications\ajc\controllers/opt.py", line 537, in <module>
File "C:\web2py\gluon\globals.py", line 421, in <lambda>
self._caller = lambda f: f()
File "C:\web2py\gluon\tools.py", line 3868, in f
return action(*a, **b)
File "c:\web2py\applications\ajc\controllers/opt.py", line 245, in index
paginate=session.auth.user.pagination,
File "C:\web2py\gluon\sqlhtml.py", line 2583, in grid
res = DIV(buttons(view=details, record=record),
File "C:\web2py\gluon\sqlhtml.py", line 2505, in buttons
elif link(record):
File "c:\web2py\applications\ajc\controllers/opt.py", line 237, in <lambda>
_href=URL('get_approval', args=[row.opt.id], user_signature=True),
File "C:\web2py\gluon\packages\dal\pydal\objects.py", line 109, in __getattr__
raise AttributeError
AttributeError
_href=URL('get_approval', args=[row.opt.id], user_signature=True),
_href=URL('get_approval', args=[str(row).split("'id': ")[1].split(',')[0]], user_signature=True),