[web2py] SQLFORM grid shows reference id instead of name

2013-02-16 Thread Edwin Haver
Hello, I have created a grid with SQLFORM but the grid shows the country id instead of the country name. The form shows the name as expected but the grid does not. However, if I use 'reference country' it does but then I cannot leave the country empty in the account. Is there an easy way, other

[web2py] Grid shows reference id when form allows empty reference

2013-02-16 Thread Edwin Haver
Hi all, When I allow the country reference to be empty in the below table, the SQLFORM.grid will show the country id instead of the name. When I just use 'reference country' it shows the country name in the grid and form but does not allow it to be empty. If I use a combination of both, it show

[web2py] Re: Grid shows reference id when form allows empty reference

2013-02-16 Thread Edwin Haver
Thanks Anthony, That works perfectly. -- --- 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. For more options, visit https:/

[web2py] How to get the SQLFORM.grid search to show the referenced table?

2013-04-14 Thread Edwin Haver
If I use reference table in a field then the search shows a dropdown of the referenced table but in the following case it does not. Field('industry', requires=IS_EMPTY_OR(IS_IN_DB(db,db.industry.id,'%(name)s')), represent=lambda id, r: db.industry[id].name if id else ""), Wh

[web2py] Re: How to select correct parent record and replace a field in that record with totals of its children

2013-04-14 Thread Edwin Haver
Hi Alex, You can use the following query to count the number of child records and then update the WhatIf table. total_children = db(db.WhatIfVote.WhatIfID == what_if_id).count() row = db(db.WhatIf.id==what_if_id).select().first() row.update_record(numberOfTentativePartners=total_children) Try

[web2py] Feature request: Callback, Target and Delete as parameters for MENU

2013-04-16 Thread Edwin Haver
Hi all, I think it would be useful to add the parameters "callback", "target" and "delete" to the MENU parameters so that it can be used for ajax requests. Let me know what you think. Regards, Edwin. -- --- You received this message because you are subscribed to the Google Groups "web2py-u

[web2py] sql statement trimmed / cut-off

2013-07-08 Thread Edwin Haver
Hello, The SQL statement produced by the following query is trimmed or cut-off somehow and therefore produces an error. Surely this must be a bug? In [5] : print db(db.holiday.leave_type == db.leave_type.id)._select(db.leave_type.name, db.holiday.working_days.sum(), groupby=db.holiday.leave_ty

[web2py] Invalid field name although rname is set

2016-11-10 Thread Edwin Haver
Hello, Why do I get the following error message when I have set the rname for that field and have set check_reserved to None? Field: invalid field name: update, use rname for "funny" namesVersion web2py™ Version 2.14.6-stable+timestamp.2016.05.10.00.21.47 Python Python 2.7.12: C:\Python27\pyt

[web2py] Re: Invalid field name although rname is set

2016-11-11 Thread Edwin Haver
rits from > pydal.helpers.classes.BasicStorage, which has methods "update", "get", > "keys", "values", etc. -- so none of those will work as field names (though > you can use them as rnames). > > Anthony > > On Friday, November 11, 2016 at 1:40:

[web2py] Form submission not working using ajax to display form in content div

2017-02-13 Thread Edwin Haver
I have written a simple index page and form for adding and updating a record. This works fine but as soon as I change the normal link to a link that loads the form with ajax in the content div, it does not work any longer. As soon as I submit the data it seems that form.process has accepted the

[web2py] Re: sqlite3.OperationalError: no such table:

2017-02-13 Thread Edwin Haver
Hi Terrence, Your db.py script has not run and this is why you get the no such table error. I believe that it should work if you run the following command: python web2py.py -S You will then get an interactive shell with the web2py environment and application loaded. Regards, Edwin On Monday

[web2py] Re: SQLFORM.grid changing the behaviour when there are no records

2017-02-13 Thread Edwin Haver
Hi Paul, You can test if the grid has rows by doing the following {{if grid.rows:}} {{=grid.rows}} {{else:}} No records {{pass}} That should do it I think. Regards, Edwin On Monday, February 13, 2017 at 7:12:53 PM UTC+4, Paul Ellis wrote: > > I want to display something else if the query

[web2py] Re: sqlite3.OperationalError: no such table:

2017-02-14 Thread Edwin Haver
ould've stated that I am using pyDAL standalone. And please > note that I did an `import db` at the top of the console session, which > should've run all the define_table statements in that file, correct? > > On Monday, February 13, 2017 at 2:36:03 PM UTC-5, Edwin Have

[web2py] Re: Form submission not working using ajax to display form in content div

2017-02-14 Thread Edwin Haver
Hi Donald, I tried that and it does not make a difference. Regards, Edwin. On Tuesday, February 14, 2017 at 12:58:19 AM UTC+4, Donald McClymont wrote: > > I haven't studied all of this but can you change the name of your > controller function to something other than form. I have had issues wit