download rows

27 views
Skip to first unread message

Andrea Fae'

unread,
Feb 14, 2018, 5:37:17 AM2/14/18
to web2py-users
Hello, I need to create a page to download rows from a dataset to a file.
Is there any automatic possibility (embedded download function is related?) without creating a function and relative view?
Thank you

Andrea Fae'

unread,
Feb 14, 2018, 6:00:15 AM2/14/18
to web2py-users
I'm explaining better.
I want to create a view with a button like "download" or something like it to generate a csv file from a select/query -> rows from database and after appears a dialog to select in which folder download the file

Thank you

Dave S

unread,
Feb 14, 2018, 3:56:45 PM2/14/18
to web...@googlegroups.com


On Wednesday, February 14, 2018 at 3:00:15 AM UTC-8, Andrea Fae' wrote:
I'm explaining better.
I want to create a view with a button like "download" or something like it to generate a csv file from a select/query -> rows from database and after appears a dialog to select in which folder download the file

Thank you

I think that the folder dialog is done by the browser on the basis of content-type and content-disposition.  But my browsers tend to assume the default directory (%home%/Downloads) and just give me the save-or-open choice.

 

Il giorno mercoledì 14 febbraio 2018 11:37:17 UTC+1, Andrea Fae' ha scritto:
Hello, I need to create a page to download rows from a dataset to a file.
Is there any automatic possibility (embedded download function is related?) without creating a function and relative view?
Thank you

The download function in the welcome app is a good starting point, but it's optimized for downloading a file that's recorded in a database table.  What you want is more like what's in appadmin.py  ... see the csv() definition.

/dps


Reply all
Reply to author
Forward
0 new messages