This is handled by the UploadWidget class in sqlhtml.py. Looks like all of
that is hard-coded. You can provide a callable (e.g., lambda) for the
download URL, but maybe we should allow a callable for the entire
link/delete element so it can be customized. For now, your best alternative
might be a custom widget for the upload field:
db.define_table('mytable', Field('myupload', 'upload',
widget=custom_upload_widget))
For details on custom widgets,
see http://web2py.com/books/default/chapter/29/7#Widgets.
Anthony
On Friday, January 13, 2012 12:59:38 AM UTC-5, mweissen wrote:
>
> Hi,
>
> I have built a form with SQLFORM(... upload=URL(r=request,
> f='download')...)
> There is a link to download the uploaded file (it's a picture) and a
> checkbox to delete this file.
>
> That is very simple and it works fine. But it does not look very nice:
>
>
>
> Foto:
> [file<http://127.0.0.1:8000/bewerbungtest/default/download/auth_user.bild.b3f61e203c036ce1.34424d5f4b6c75675f4c756b61732e6a7067.jpg>
> |delete]
>
> No spaces around the word "file", no space between the checkbox and the
> word "delete" and all in one row.
>
> It seems, that the "T-operator" is missing for "fle" and "delete"!
>
> I want to change the layout and to put these elements below the picture or
> at least in a new row. Further I want to remove the square brackets.
>
> - Is there any parameter to change the layout?
> - Or is it possible to use the "extra form elements" to re-build this
> part of the form?
> - Or could another function instead of f='download' the solution?
>
> *I have tried to find the source code of this part, but I did not find it.
> *
> Is there any detailed description of the upload parameter?
>
> Regards, Martin
>