With SQLFORM edit forms, the link for upload fields appears automatically when a record (or record id) is passed to the SQLFORM constructor via the "record" argument. You are not using that argument, hence you get no link. You can either pass a record (or a dict or Storage object whose keys are the same as the field names in your tables) to SQLFORM and let it fill in all the field values for you (including creating the link for the upload field), or you can create a custom widget for the db field and embed the link to the file in the widget (or you can even use the server side DOM to add the link to the form after the form has been created).
Anthony On Thursday, January 24, 2013 8:59:06 AM UTC-5, Ramos wrote: > > You are telling me that sqlform.factory is not good for editing records > with uploaded files because the link does not show up in the view? > > I kill myself. :) > > > 2013/1/24 Anthony <abas...@gmail.com <javascript:>> > >> form=SQLFORM.factory(db.**trabalhador,db.t_docs, >> >> submit_button="Gravar", >>> fields=['nome','bi','ncart','**ncartval','apt_medica','apt_** >>> medicaval','val_formacao','f_**doc'], >>> table_name='trabalhador', >>> upload=URL('default', 'download'), >>> uploadfolder=os.path.join(**request.folder,'uploads') >>> ) >>> >> >> Note, uploadfolder is an argument of Field(), not of SQLFORM() or >> SQLFORM.factory(). >> >> for field in row: >>> >>> if field in db.trabalhador.fields: >>> print "setting -",row[field] ," on ",field >>> form.vars[field]=row[field] >>> >> >> When you specify the upload argument to SQLFORM, it creates the link to >> the file in the edit form when the form is created (i.e., in >> SQLFORM.__init__()). Setting the value of form.vars[your_upload_field] >> after the form has been created will not result in that link being added to >> the form. >> >> Anthony >> >> -- >> >> >> >> > > --