[web2py] uploadfolder=request.folder not working as it expected

2020-10-05 Thread mostwanted
*uploadfolder=request.folder+'static/docs'  *suddenly aint working as it 
should, initially is worked. What should happen is that when i save a PDF 
file it should be save in a static folder called *docs  *& in a database 
table but the *docs *folder in static doesnt get created now I am getting 
the *404 NOT FOUND *when i try to view or open the PDF. I dont know why 
this is suddenly happening when it used to work, do i need import some 
python library or change my code somwhere?

*CODE:*
*model:*




*db.define_table('pdfs',Field('Form_Name', 
label=SPAN('Document Title', _style="font-weight: bold;"), widget=lambda 
field, value:SQLFORM.widgets.string.widget(field, value, 
_placeholder="Invoice/PO/Quotation Name")),Field('status', 
'boolean', label=SPAN('Status (For Invoices Only)', _style="font-weight: 
bold;")),Field('status_condition', 
requires=IS_IN_SET(['Quotation', 'Paid', 'Unpaid', 'Cancelled', 'Paid With 
Balance'], zero=None), label=SPAN('Status Condition', _style="font-weight: 
bold;")),
Field('fileS','upload',uploadfolder=request.folder+'static/docs', 
label=SPAN('Upload Files', _style="font-weight: bold;")))*

*CONTROLLER:*




*def saveDocument():form=SQLFORM(db.pdfs)if 
form.process().accepted:response.flash=T('Form Saved')return 
locals()*



*def viewer():row = 
db(db.pdfs.id==request.args(0)).select(db.pdfs.fileS).first()
redirect(URL('static','docs',args=row.fileS))*


*VIEW FOR SAVED DOCUMENT VIEWING*

*{{extend 'layout.html'}}*



*{{for details in details2: }}{{=A(details.Form_Name, 
_target="_blank", _href=URL('viewer', args=details.id))}} {{pass}}*

Regards;

Mostwanted

-- 
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 web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/0e934eae-fd5b-48b1-a744-42c8d89702fen%40googlegroups.com.


[web2py] Re: SQLFLORMGRID

2020-10-05 Thread lcham...@gmail.com
thank you, i test

Le vendredi 2 octobre 2020 à 17:04:06 UTC+2, agent...@gmail.com a écrit :

> From the documentation 
> :
>  
>
> "onvalidation, onfailure, oncreate, onupdate and ondelete are callback 
> functions. All but ondelete take a form object as input, ondelete takes 
> the table and the record id. Because the edit/create form is an SQLFORM 
> which extends FORM, these callbacks are essentially used in the same way as 
> documented in the sections for FORM and SQLFORM. "
>
> So, when you declare the grid, you link the function that you want to run 
> to: oncreate=myoncreate 
>
> On Thursday, October 1, 2020 at 9:07:34 AM UTC-5 lcham...@gmail.com wrote:
>
>>
>> Hello,
>> i use sqlformgrid and like this :
>> controller:
>> def art_manage():
>> records= SQLFORM.grid(query=db.t_art,maxtextlength = 
>> 40,deletable=False,create=True, fields=[db.t_art.f_name, db.t_art.f_team, 
>> db.t_art.f_tit])
>> return dict(records=records)
>>
>> view:
>> {{=records}}
>>
>>
>> the records displayed are good and i let the possibility to add records 
>> (create=True). 
>> My question is : when i add a record and i submit i would to exectue a 
>> function , how can i do ?
>> Thank you
>>
>> (i know how to do with form .. if form.process (onvalidation .. and so on)
>>
>>

-- 
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 web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/419b948c-65c6-456e-a3c8-caafd9338168n%40googlegroups.com.


Re: [web2py] SQLFLORMGRID

2020-10-05 Thread lcham...@gmail.com
thank you

Le lundi 5 octobre 2020 à 03:43:05 UTC+2, roge...@gmail.com a écrit :

> Hi
>
> I have used the DAL to execute code before or after I make database 
> changes. Maybe that might work in your situation:
>
> http://www.web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#callbacks-on-record-insert-delete-and-update
>  
>
> Cheers
> Andrew
>
> ___
> *www.TenOutOfTen.org* 
> roge...@gmail.com
> (+95) 09 250018669 <+95%209%20250%20018%20669> (Myanmar)
>
>
>
> On Fri, 2 Oct 2020 at 00:07, lcham...@gmail.com  
> wrote:
>
>>
>> Hello,
>> i use sqlformgrid and like this :
>> controller:
>> def art_manage():
>> records= SQLFORM.grid(query=db.t_art,maxtextlength = 
>> 40,deletable=False,create=True, fields=[db.t_art.f_name, db.t_art.f_team, 
>> db.t_art.f_tit])
>> return dict(records=records)
>>
>> view:
>> {{=records}}
>>
>>
>> the records displayed are good and i let the possibility to add records 
>> (create=True). 
>> My question is : when i add a record and i submit i would to exectue a 
>> function , how can i do ?
>> Thank you
>>
>> (i know how to do with form .. if form.process (onvalidation .. and so on)
>>
>> -- 
>> 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 web2py+un...@googlegroups.com.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/web2py/399f0935-40d6-4277-829e-2fe5f7f0784bn%40googlegroups.com
>>  
>> 
>> .
>>
>

-- 
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 web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/e39ad404-4e32-441d-af64-d8d0d4a14e59n%40googlegroups.com.