thanks.
db(db.ensaios.codigo_registro == "novo ensaio").update(en_pdf=stream)
works for me!!
thanks again!
2018-04-03 7:09 GMT-03:00 Dave S <[email protected]>:
> On Monday, April 2, 2018 at 12:50:38 PM UTC-7, Diego Tostes wrote:
>>
>> Hi,
>>
>> I already use this:
>>
>> stream = open("<path>/teste_en.pdf", 'rb')
>> db.ensaios.insert(codigo_registro="novo ensaio",
>> en_pdf=stream
>> )
>>
>>
> You're using this to read the file into the uploads table? You haven't
> set "uploadfield=True" on your upload fields, so the model is expecting the
> file to be stored in the uploads directory, and a filename to be filled in
> as the field value.
>
>
>>
>> but I need to know if is a possible update a row with an upload.
>>
>>
> I would think so, but the most common usage seems to be just to make a new
> entry with every upload, with the form.process.accepted doing an insert,
> except if you've set the record parameter to SQLFORM(). See
> <URL:http://web2py.com/books/default/chapter/29/07/forms-
> and-validators#SQLFORM-and-insert-update-delete>
> (and a brief mention in the SQLFORM() signature a couple paragraphs above)/
>
> You may want to show us the controller code you are using if this doesn't
> answer your questions.
>
> /dps
>
>
>>
>> 2018-04-02 14:27 GMT-03:00 Diego Tostes <[email protected]>:
>>
>>>
>>>
>>> 2018-04-02 13:22 GMT-03:00 Diego Tostes <[email protected]>:
>>>
>>>> Hi,
>>>>
>>>>
>>>> i have a table in my model called ensaios:
>>>>
>>>> Ensaios = db.define_table('ensaios',
>>>> Field('codigo_registro', 'string'),
>>>> Field('url', 'string'),
>>>> Field('titulo_pt', 'string'),
>>>> Field('titulo_en', 'string'),
>>>> Field('tags', 'text'),
>>>> Field('contato_publico', 'string'),
>>>> Field('email_contato_publico', 'string'),
>>>> Field('pt_pdf', 'upload'),
>>>> Field('en_pdf', 'upload'),
>>>> Field.Virtual('relatorio', lambda row: A('Relatorio',
>>>> _href=URL('default',
>>>> 'ensaios',
>>>> vars=dict(ensaio_id=
>>>> row.ensaios.id)))),
>>>> )
>>>>
>>>>
>>>> i will store pdfs from clinical trials. the problem is that i already
>>>> have more than 5000 pdfs.
>>>>
>>>> i tried to put all the pdfs inside of the
>>>> "web2py/applications/ensaiosclinicos/uploads"
>>>>
>>>>
>>>> and did insertions of the names of the files in the database. But I am
>>>> getting a error :
>>>>
>>>> 404 NOT FOUND
>>>>
>>>> Is it possible to do this ?
>>>>
>>>>
>>>> rgds
>>>>
>>>> Diego
>>>>
>>>>
>>>>
>>>
>> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
>
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.