Hi guys,
New to web2py and have a potentially simple question about smartgrid.
In "db.py" I have an archive enabled after definition of my 'work_log'
table:
## after defining tables, uncomment below to enable auditing
auth.enable_record_versioning(db)
in "default.py" controller I have the following:
@auth.requires_login()
def work_log_manage():
is_owner = (lambda row: row.created_by == auth.user_id) if auth.user
else False #Determine if user is an owner of a record
db.work_log.id.readable=False # Since we do not want to expose the id
field on the grid
db.work_log_archive.id.readable=False # Since we do not want to expose
the id field on the grid
db.work_log.created_by.readable=True # Show owner of a record
orderby = ['created_on'] # Order by record creation date
grid = SQLFORM.smartgrid(db.work_log, editable=is_owner,
deletable=is_owner, user_signature=True, paginate=30,
maxtextlengths={'work_log.f_job_title_format_no':50}, orderby=orderby)
return dict(grid=grid)
The goal is for each user to only be able to edit or delete his/her own
record. It works perfectly
<https://lh3.googleusercontent.com/-0ZOMoy7jcys/Uz3Y-BLpZrI/AAAAAAAABeE/DdFGkUwEpN8/s1600/work_log.png>
As you can see there's "Work log archives" link before the button. When I
click on it, it takes me to an archive for that record and they have the
same buttons attached to the right of every 'version'. How do I disable
all buttons only in an archive table? Also, is there a way to change the
wording on that link to something different than "Work log archives" in
smartgrid?
--
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.