[web2py] simple file uploader to database as a plugin

2016-06-14 Thread Vic Ding
Hi all, I know it's 2 things in one post: how to make a file uploader as a plugin? It should upload a file store it in the database and keep a record of the table and record to which it belong to (associate the uploaded file with a record in another table). model is plugin_upload_file.py

[web2py] Re: html helper A with delete attribute not working, the div is not removed

2016-05-17 Thread Vic Ding
"record removed" db(db.product.id == productid).delete() On Sunday, May 15, 2016 at 5:49:34 PM UTC+2, Vic Ding wrote: > > Hi all, > > I am new to web2py. > I have a HTML helper > > DIV( > DIV(A('delete', callback=URL('removeProduct/'+str(row.id)),

[web2py] Re: html helper A with delete attribute not working, the div is not removed

2016-05-17 Thread Vic Ding
)) The convention is to use substitution or the concatenation? %s or +? I am used to concatenation, but do not see %s the substitution as a road block. Any difference? On Sunday, May 15, 2016 at 5:49:34 PM UTC+2, Vic Ding wrote: > > Hi all, > > I am new to web2py. > I have a HTML

[web2py] Re: MY auth mailer not wprking please check code and send me changes?

2016-05-17 Thread Vic Ding
You mentioned "mail not deliver to mailer". Mailer is the person or the mailing program, in your case: google? I am no expert in web2py, trying to see it from different angle. Have you checked the mail log to verify if the mail is received and sent by the mailer? Many mailers do not work out of

[web2py] Re: html helper A with delete attribute not working, the div is not removed

2016-05-17 Thread Vic Ding
able leads to 404 page not found on some never called function. Thanks a lot for all your useful information and help! Cheers, Vic On Sunday, May 15, 2016 at 5:49:34 PM UTC+2, Vic Ding wrote: > > Hi all, > > I am new to web2py. > I have a HTML helper > > DIV( > DIV(A('de

Re: [web2py] html helper A with delete attribute not working, the div is not removed

2016-05-16 Thread Vic Ding
6, 2016 at 2:28:03 PM UTC+2, Manuele wrote: > > Do you get any output in the browser console? Maybe some error in the > javascript code passed in the header response? > > Cheers > > M. > > Il 16/05/16 12:23, Vic Ding ha scritto: > > Hi Manuele, > Tried the

[web2py] Re: html helper A with delete attribute not working, the div is not removed

2016-05-16 Thread Vic Ding
e Ajax request is > returning successfully (check the browser developer tools and make sure the > XHR request returns with a 200 response)? Also, check for any errors in the > Javascript console. > > Anthony > > On Sunday, May 15, 2016 at 11:49:34 AM UTC-4, Vic Ding wrote: &

[web2py] Re: html helper A with delete attribute not working, the div is not removed

2016-05-16 Thread Vic Ding
be triggered. > > Anthony > > On Monday, May 16, 2016 at 3:15:54 PM UTC-4, Vic Ding wrote: >> >> HI Anthony, >> >> There is one mysterious 404 to the remove function, to a wrong URL which >> I never called. However, the record is indeed successfully removed f

Re: [web2py] html helper A with delete attribute not working, the div is not removed

2016-05-16 Thread Vic Ding
Hi Manuele, Tried the later one. Did not work for me. The delete button flipped to "working..." for split second then back to

[web2py] html helper A with delete attribute not working, the div is not removed

2016-05-15 Thread Vic Ding
Hi all, I am new to web2py. I have a HTML helper DIV( DIV(A('delete', callback=URL('removeProduct/'+str(row.id)), delete='div#product'+str(row.id)), _class='delete_button'), _class='product', _id='product'+str(row.id) ) The callback to removeProuct/id is working well, however,

[web2py] problem display drop down list when self reference table

2016-05-06 Thread Vic Ding
Dear all, I have the following table definition; db.define_table('category', auth.signature, Field('name','string'), Field('parent', 'reference category', requires=IS_EMPTY_OR(IS_IN_DB(db, 'category.id'))), format='%(name)s' ) In

[web2py] Re: problem display drop down list when self reference table

2016-05-06 Thread Vic Ding
#Database-validators > > The third argument lets you specify how you want the items represented via > Python string formatting (or alternatively using a function). > > Anthony > > On Friday, May 6, 2016 at 10:14:23 AM UTC-4, Vic Ding wrote: >> >> Dear all, &

[web2py] create file outside of web2py using IDE

2016-05-04 Thread Vic Ding
Hi all, I am using Pycharm together with web2py. I created a model file models/db1.py in IDE and sync it back to the server through SSH. The file is pickup by the server (I can see it in the web IDE) however, I get a complain when visiting the site name 'db' is not defined How can I deal with

[web2py] db is not defined in other model files

2016-05-04 Thread Vic Ding
Hi all, I have a weird problem with web2py on apache. I created db1.py and created defined tables in it and it works fine. I created another model, name is my_list.py and it does not work. Error is db is not defined in my_list.py. Any idea what the problem might be? Thanks! -- Resources: -

[web2py] Re: db is not defined in other model files

2016-05-05 Thread Vic Ding
quot;. Is there a better way to organise the model >> files? Does this mean that the model files are loaded in alphabetical >> order? >> >> Thanks in advance >> >> Vic >> >> >> >> On Wednesday, May 4, 2016 at 6:09:29 PM UTC+2, Anthony wr

[web2py] Re: db is not defined in other model files

2016-05-05 Thread Vic Ding
o organise the model files? Does this mean that the model files are loaded in alphabetical order? Thanks in advance Vic On Wednesday, May 4, 2016 at 6:09:29 PM UTC+2, Anthony wrote: > > Does it work locally? > > On Wednesday, May 4, 2016 at 11:56:07 AM UTC-4, Vic Ding wrote: >

Re: [web2py] Weird

2016-08-12 Thread Vic Ding
how to walk around the issue? Thanks again. On Monday, August 8, 2016 at 3:42:26 PM UTC+2, Richard wrote: > > Do you have an "id" field defined? > > Richard > > On Sat, Aug 6, 2016 at 6:31 AM, Vic Ding <dingq...@gmail.com > > wrote: > >> I created

[web2py] Weird

2016-08-06 Thread Vic Ding
I created the table initially without the virtual field 'amount' and added it lately. When I use a string or number in the lambda like: lambda row: 'test', it works fine. However, when I use lambda row: row.id it gave the error below. It's really like push here and feel the pain 2km away.

[web2py] question on how to use pdfinvoice

2016-08-21 Thread Vic Ding
Hi all, I am trying to generate pdf using pdfinvoice. The invoice is being generated and presented in the view. I am wondering, how can I customise the layout of the invoice? Is the layout linked with generic.pdf or some other template? What's the best way to make a better layout? Can I use a

[web2py] problem with sqleditable

2016-10-27 Thread Vic Ding
Dear all, I am using SQLEDITABLE to manage a record set. However, only the visible ones are being edited/inserted. The not visible ones, including auth info are not recorded. For example, I set > db.purchase_order_product.currency.default =1 > >

[web2py] Re: problem with sqleditable

2016-11-02 Thread Vic Ding
Hi Peter, The code is from the editPO controller. Tried the writable = True, but no luck. It seems to me like the fields must be readable and writable at the same time to be properly inserted. Might just have to show all the fields and hide some of them using javascript. Or rewrite the

[web2py] Re: posibility to disable the mobile admin interface

2017-08-15 Thread Vic Ding
admin/controllers/default.py" file at line > nr.3 set EXPERIMENTAL_STUFF to False > > You must apply the above change every time you update web2py. > > > Il giorno lunedì 14 agosto 2017 12:50:39 UTC+2, Vic Ding ha scritto: >> >> I know this is pretty old post, but is ther

[web2py] Re: posibility to disable the mobile admin interface

2017-08-14 Thread Vic Ding
I know this is pretty old post, but is there a way to do so? Thanks! On Tuesday, November 22, 2016 at 10:30:24 AM UTC+1, Oli wrote: > > is there a posibility to disable the mobile interface? there is only a > white screen on pythonanywhere.com with web2py version 2.14.6 . -- Resources: -

[web2py] change represent of referenced filed in SQLFORM update

2017-08-05 Thread Vic Ding
Hi all, I have been hitting the wall for probably a simple problem. I have 2 tables sales order and customer, db.sales_order.customer reference customer table. db.define_table('customer', auth.signature, Field('name', 'string', requires=IS_NOT_EMPTY(),

[web2py] Re: change represent of referenced filed in SQLFORM update

2017-08-05 Thread Vic Ding
r', > ..., > format='%(name)s, %(address)s, %(city)s') > > Alternatively, you can explicitly set your own validator for the reference > field: > > Field('customer', 'reference customer', > requires=IS_IN_DB(db, 'customer.id', '%(name)s, %(address)s, > %(ci

[web2py] Re: change represent of referenced filed in SQLFORM update

2017-08-06 Thread Vic Ding
works like a charm! On Sunday, August 6, 2017 at 4:39:07 PM UTC+2, Anthony wrote: > > On Saturday, August 5, 2017 at 4:12:43 PM UTC-4, Vic Ding wrote: >> >> Thanks for the help, it works. However, this alters the table definition. >> 1) Is there a way that the value

[web2py] impact of deploying w2p file

2018-04-28 Thread Vic Ding
Dear all, I am wondering if there is any impact on database transactions or database content when deploying w2p file. Does the package only contain code or in some way some data as well? The database folder contains some kind of transaction logs, this folder and all its contents will be over

[web2py] Re: virtual field not exportable to CSV

2018-08-12 Thread Vic Ding
It turns out that in the objects.py, export_to_csv gets the fields from the grid, but when getting the column name to be used as the dict key to fetch the actual field object, the key is invalid. any idea to quick solve this? Thanks! On Thursday, August 9, 2018 at 10:07:19 PM UTC+2, Vic Ding

[web2py] virtual field not exportable to CSV

2018-08-09 Thread Vic Ding
I have one virtual field in SQLFORM.grid which works fine. However, when I want to export the grid to CSV, it complains '"po"."amount"' is it a bug or expected behaviour? Thanks! -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py

[web2py] problem export virtual field to CSV using grid

2018-04-08 Thread Vic Ding
Hi all, I am having issue exporting virtual fields to CSV using grid. It displays fine though. I defined field in this way Field.Virtual('cost_value', lambda row: row.inventory.cost_price_avg * row.inventory.qty, label=T('Stock value')), When I export it to CSV in grid I got the following