Hi all,
I have been working on a project for a while now and am struggling to
figure out a solution to tracking/logging user downloads..
The download links are placed directly into the Upload_file column and
printed out using SQLFORM.grid , as seen below.
Upload File Ref Letter (e.g. aa)DescriptionUpload By Upload Date
Filename
Download File None None Leon Grant
2017-12-13 17:32:25 test_doc_2.txt
As you can see, the table also stores the original filename. What I need is
to be able to return the row ID or Filename upon clicking the
"Download File" link. Does anybody have any ideas as to how I can
accomplish this given the current setup, or do I need to change the format
and go another route completely?
Here is some of my code.. I know that grid can track the row.id as I have
inserted a test "link" to view the ID. I just need to be able to
combine the two somehow so the user can get their file and I can return the
file name for logging..
form_downloads=SQLFORM.grid(((db_this_table.form==form_id) &
(db_this_table.upload_type==file_type) &
(db_this_table.upload_group==group_id)),
args=request.args[:2],
links = [lambda row: A('Review ID',_href=URL("default","form",
args=[row.id]))],
fields=[db_this_table.upload_file,
db_this_table.reference_letter,db_this_table.description,
db_this_table.upload_by, db_this_table.upload_date, db_this_table.filename],
csv=auth.has_group_membership_or(["administrator", "systemadmin",
"content_manager"]) or
__content_manager_assistant_permission_edit_waveform_type(form_id,
file_type),
searchable=False,
editable=auth.has_group_membership_or(["administrator", "systemadmin",
"content_manager"]) or
__content_manager_assistant_permission_edit_waveform_type(form_id,
file_type),
details=False,
create=auth.has_group_membership_or(["administrator", "systemadmin",
"content_manager"]) or
__content_manager_assistant_permission_edit_waveform_type(form_id,
file_type),
deletable=auth.has_group_membership_or(["administrator", "systemadmin",
"content_manager"]) or
__content_manager_assistant_permission_edit_waveform_type(form_id,
file_type),
maxtextlength=10000,
selectable=lambda ids: move_files(ids) and
auth.has_group_membership_or(["administrator", "systemadmin",
"content_manager"])
)
--
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.