Could you please show me a sample script or point me some links to study?
I´m out of ideas now. I´m using sqlform.factory to show 2 tables in the
same form.Is factory the best option?
Can i just use sqlform to do the same thing? sqlform has the option of
passing a record.But how about links to uploaded files when editing a
record ?

*1 - 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)*
*How does a SQLFORM create the link for the upload field when editing a
record?*

2  *or you can create a custom widget for the db field and embed the link
to the file in the widget*
*How to?*
*
*
Believe me, i´m very tired with this. But i cannot give up now. My app is
almost finished.
Its about to go live in my company and is to be used by our safety
department and all outside companies that have people working with us.

Its just 2 or more details and it is finished.

*
*
*Thank you a lot for your time.*
*António
*
2013/1/24 Anthony <abasta...@gmail.com>

> 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>
>>
>>  form=SQLFORM.factory(db.**traba**lhador,db.t_docs,
>>>
>>>         submit_button="Gravar",
>>>>         fields=['nome','bi','ncart','**n**cartval','apt_medica','apt_**
>>>> med**icaval','val_formacao','f_**doc'**],
>>>>         table_name='trabalhador',
>>>>         upload=URL('default', 'download'),
>>>>         uploadfolder=os.path.join(**requ**est.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
>>>
>>> --
>>>
>>>
>>>
>>>
>>
>>  --
>
>
>
>

-- 



Reply via email to