A litle more explaining
First i create my form.factory
then i query the database form a record and set the fields in my form
This is a form to edit a record

here is my code

 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')
        )
    if request.args(0):
        row=db((db.trabalhador.id==request.args(0))).select().first()
        print row
        foto=row['foto'] or None
        #print foto
        if row:
            for field in row:

                if field in db.trabalhador.fields:
                    print "setting -",row[field] ," on ",field
                    form.vars[field]=row[field]

My view is a simple as
{{=form}}


When i edit a record, all fields are populated except upload fields. Is as
if no file is in the record field.

Help would be apreciated.
Thank you
António


2013/1/24 António Ramos <ramstei...@gmail.com>

> i added
>            upload=URL('default', 'download'),
>            uploadfolder=os.path.join(request.folder,'uploads')
>
>  form=SQLFORM.factory(db.auth_user,db.e_docs,
>         submit_button="Gravar",
>
>  
> fields=['empresa','email','telefone','alvara','alvaraval','segrespcivil','segrespcivilval','segactrab','segactrabval','obs','f_doc']
> ,
>            table_name="auth_user",
>            upload=URL('default', 'download'),
>            uploadfolder=os.path.join(request.folder,'uploads')
>         )
>
> *Still dont see the link*
>
>
>
> 2013/1/24 Paolo valleri <paolo.vall...@gmail.com>
>
>> upload=URL('default', 'download')
>
>
>
>

-- 



Reply via email to