>
> Another alternative is to change the representation of the file field in
> the controller function before creating the SQLFORM.grid. For example:
>
> db.datasets.file.represent = lambda value, row: A('Download file', _href=
> URL('datasets', 'download_dataset', vars={'id': row.id}))
>
> I tho
And in my case, using the represent option to feed an id variable to the
URL, a download function like this works:
from gluon.contenttype import contenttype
def download_dataset():
# get the id and record
ds_id = request.vars['id']
if ds_id is None:
# non-existent id
Thanks, Anthony. So to sum up what I think the options are:
1) The code laying out the standard SQLFORM.grid record view handles the
display of each field and - for upload fields - the download link uses:
https://.../controller/sqlform_grid_function/download/file_name
That can be changed using
On Saturday, February 3, 2018 at 1:58:26 AM UTC-5, David Orme wrote:
>
> So at the moment, what users are seeing is a controller presenting
> SQLFORM.grid of dataset records, and then in the 'view' argument to that
> controller for a particular record, the file field is shown as the output
> of
So at the moment, what users are seeing is a controller presenting
SQLFORM.grid of dataset records, and then in the 'view' argument to that
controller for a particular record, the file field is shown as the output
of the represent method of UploadWidget (so the word 'file' wrapped up with
the d
On Friday, February 2, 2018 at 5:04:26 PM UTC-5, David Orme wrote:
>
> Hi,
>
> I'm collecting dataset files from users. There can be several versions as
> problems with the files get fixed and I want to organise the uploaded files
> by their common dataset id. So in my controller I do this:
>
> #
6 matches
Mail list logo