hi,
is it possible to have conditional in smartgrid that refer to the boolean
type of field?
e.g.
*default.py*
def invoice():
is_authorized = db.invoice_header.is_authorized==True # for testing, print
the value in the html output
if db.invoice_header.is_authorized==True:
grid = SQLFORM.smartgrid(db.invoice_header, deletable=False, editable=False)
else:
grid = SQLFORM.smartgrid(db.invoice_header, deletable=True, editable=True)
return locals()
*default/invoice.html*
{{extend 'layout.html'}}
{{=grid}}
{{=is_authorized}}
{{=response.toolbar()}}
whatever the value of is_authorized (True or False) it will return True in
the output, i mean the deletable and editable is set to False in the grid.
when i print the value of is_authorized in the view it return :
(invoice_header.is_authorized = 'T')
then i try to change the codition from
if db.invoice_header.is_authorized==True:
into
if db.invoice_header.is_authorized=='T':
but have the same result.
my goal is each invoice that have not authorized can be delete and edit,
and the invoice that have been authorized can not be delete and edit.
any idea how to handle this situation?
thanks and best regards,
stifan
--
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/groups/opt_out.