[web2py] Adding checkboxes to sqlform.factory and form validation based on another table

2014-02-05 Thread Apple Mason
If we have these simple models: db.define_table('person', Field('name', 'string')) db.define_table('common_allergies', Field('name', 'string')) The common_allergies is a table full of common allergies that people may have like 'peanuts' or 'bee stings'. This table is pre-populated by the

[web2py] Re: Adding checkboxes to sqlform.factory and form validation based on another table

2014-02-05 Thread Apple Mason
I forgot to highlight code samples in my last post. Sorry about that. If we have these simple models: db.define_table('person', Field('name', 'string')) db.define_table('common_allergies', Field('name', 'string')) The common_allergies is a table full of common allergies that people may

[web2py] Re: Querying rows over several many-to-many tables.

2014-01-29 Thread Apple Mason
(whole_set)(what_I_want).select() On Wednesday, January 29, 2014 6:29:10 AM UTC+1, Apple Mason wrote: I want to search across some many to many tables, but with certain conditions. db.define_table('person', Field('name', 'string'), Field('nickname', 'string')) db.define_table

[web2py] Re: Querying rows over several many-to-many tables.

2014-01-29 Thread Apple Mason
(db.clothing.name.belongs(clothings)) rows = db(q).select(db.person.ALL) return rows On Wednesday, January 29, 2014 11:03:06 PM UTC+1, Apple Mason wrote: Is there a more lenient version of what_I_want that will give me based on what I put in? For example

[web2py] Querying rows over several many-to-many tables.

2014-01-28 Thread Apple Mason
I want to search across some many to many tables, but with certain conditions. db.define_table('person', Field('name', 'string'), Field('nickname', 'string')) db.define_table('clothing', Field('name', 'string')) db.define_table('item', Field('name', 'string'))

[web2py] Re: Form on every page?

2014-01-27 Thread Apple Mason
27, 2014 12:20:50 AM UTC-5, Apple Mason wrote: Oh, it's probably because the url is /index.html and not /searchform.html. In that case, how would I create a search form that is present globally in the site? On Monday, January 27, 2014 12:04:43 AM UTC-5, Apple Mason wrote: My controller

[web2py] Re: Form on every page?

2014-01-27 Thread Apple Mason
in the view depends on your needs. Do you just need a single text search field? What does the search function do to return results? Anthony On Monday, January 27, 2014 1:02:03 PM UTC-5, Apple Mason wrote: I found this thread that has a similar problem: https://groups.google.com/forum

[web2py] Re: Form on every page?

2014-01-27 Thread Apple Mason
making GET requests open to the public? In that case, I don't think you need to worry about CSRF or input sanitizing. Anthony On Monday, January 27, 2014 2:16:04 PM UTC-5, Apple Mason wrote: If I manually create the raw html form and set the action attribute, how would I get csrf protection

[web2py] Form on every page?

2014-01-26 Thread Apple Mason
I have a search bar that I want to display on every page, but something is not working. Here is an example of what I have: layout.html: html body div class=searchbar {{include 'default/searchbar.html'}} /div div class=main/div /body /html In default/searchbar.html: {{=form}} But

[web2py] Re: Form on every page?

2014-01-26 Thread Apple Mason
My controller default.py: def searchbar: form = SQLFORM() return (form=form) On Monday, January 27, 2014 12:03:37 AM UTC-5, Apple Mason wrote: I have a search bar that I want to display on every page, but something is not working. Here is an example of what I have

[web2py] Re: Form on every page?

2014-01-26 Thread Apple Mason
Oh, it's probably because the url is /index.html and not /searchform.html. In that case, how would I create a search form that is present globally in the site? On Monday, January 27, 2014 12:04:43 AM UTC-5, Apple Mason wrote: My controller default.py: def searchbar: form = SQLFORM

[web2py] Re: Multiple one-to-many join query help.

2014-01-24 Thread Apple Mason
, Apple Mason wrote: I have the following tables: db.define_table('person', Field('name', 'string')) db.define_table('pet', Field('name', 'string'), Field('person_id', 'reference person')) db.define_table('thing', Field('name', 'string'), Field('person_id', 'reference

[web2py] Multiple one-to-many join query help.

2014-01-22 Thread Apple Mason
I have the following tables: db.define_table('person', Field('name', 'string')) db.define_table('pet', Field('name', 'string'), Field('person_id', 'reference person')) db.define_table('thing', Field('name', 'string'), Field('person_id', 'reference person')) I have a

[web2py] Re: Is there a way to have a field in one table be computed by a field in another table?

2014-01-14 Thread Apple Mason
_after_insert and _after_update callbacks for db.thing (see http://www.web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#before-and-after-callbacks ). Anthony On Tuesday, January 14, 2014 12:48:59 AM UTC-5, Apple Mason wrote: In the online doc on computed field

[web2py] Re: Is there a way to have a field in one table be computed by a field in another table?

2014-01-14 Thread Apple Mason
I read through the link you show me. I'm using _before_delete now, since doing s.select() returns 0 rows since it's already been deleted. I'm not sure how to deal with sets in _after_delete. Here is my updated models: db.define_table('person', Field('name'),

[web2py] Re: Is there a way to have a field in one table be computed by a field in another table?

2014-01-14 Thread Apple Mason
Yeah, that thread says to use _before_delete, and it fits this use case. Can you verify if what I'm seeing about the delete is correct? The _before_delete is causing the admin panel to not delete the record for some reason. Is it a bug? I'm using web2py 2.7.4 stable On Tuesday, January 14,

[web2py] Is there a way to have a field in one table be computed by a field in another table?

2014-01-13 Thread Apple Mason
In the online doc on computed field, the computed fields uses a field in the current table, and not in another table. I modified the one-to-many example by adding a 'total_items' field on person. If I want 'total_items' to be the sum of all items the person currently has, and this field should

[web2py] incomplete format error when trying to insert ids

2014-01-09 Thread Apple Mason
My many-to-many table is throwing an error every time I access that table in the admin page: type 'exceptions.ValueError' incomplete format Traceback (most recent call last): File /home/apl/Desktop/web2py/gluon/restricted.py, line 217, in restricted exec ccode in environment File

[web2py] Re: incomplete format error when trying to insert ids

2014-01-09 Thread Apple Mason
Nevermind, I figured it out. My format string was wrong. After fixing that, everything works. On Thursday, January 9, 2014 4:42:01 PM UTC-5, Apple Mason wrote: My many-to-many table is throwing an error every time I access that table in the admin page: type 'exceptions.ValueError

[web2py] Sharing fields across different tables in models?

2014-01-08 Thread Apple Mason
If we have a table full of products, but some products use slightly different fields, how should this be represented? For example, if I sell clothing and furniture: clothing and furniture share these fields: - price - description - stock - name clothing have these special fields: -

[web2py] How to map custom code to specific user roles to determine the auth_user field?

2013-10-14 Thread Apple Mason
Suppose I have three different types of users: buyer, distributor, and reseller. All buyers, distributors, and resellers have an email, password, and ratings. Since email and password are already part of auth_user, the ratings Field will be an extra field in auth_user. To separate the user

Re: [web2py] missing 'index' in url with routes.py?

2013-10-10 Thread Apple Mason
Thanks Jonathan, I ended just pointing the default function to a main() and from there I redirected to my index() in my controller. On Thursday, October 10, 2013 5:47:22 PM UTC-4, Jonathan Lundell wrote: On 9 Oct 2013, at 9:11 PM, Apple Mason apl...@gmail.com javascript: wrote: I'm trying

[web2py] missing 'index' in url with routes.py?

2013-10-09 Thread Apple Mason
I'm trying to shorten the url from something like: www.example.com/myapp/default/index?page=1 to www.example/com/index?page=1 I'm using pagination on the index page, so that's why you see the ?page=1 My routes.py is pretty standard: routers = dict( # base router BASE=dict(

[web2py] Redirect to my own 404 page through a custom error handler?

2013-09-20 Thread Apple Mason
I would like to throw a 404 when a user tries to access something that doesn't exist, like trying to access a non-existent comment by providing a comment id that doesn't exist in the database. In these cases, web2py will throw an exception and point to a ticket (ie, NoneType has no attribute

[web2py] Re: Redirect to my own 404 page through a custom error handler?

2013-09-20 Thread Apple Mason
Nevermind, I think I've figured things out. Although I noticed that routes_onerror doesn't do anything if it's in the application-specific routes.py. It works if I place it in the web2py root routes.py. Is this intentional? On Friday, September 20, 2013 2:27:20 AM UTC-4, Apple Mason wrote

[web2py] Updating the auth_user profile that also has a one-to-many field?

2013-09-09 Thread Apple Mason
I created a custom profile view so that the user can create/update his profile. Currently I have something like: models/db.py: db.define_table('images', Field('image', 'upload', requires = IS_EMPTY_OR(IS_IMAGE())) auth.settings.extra_fields['auth_user'] = [ Field('user_image', 'reference

[web2py] Re: Updating the auth_user profile that also has a one-to-many field?

2013-09-09 Thread Apple Mason
your own profile update/insert page, dealing with all the things you explained . On Monday, September 9, 2013 9:50:40 PM UTC+2, Apple Mason wrote: I created a custom profile view so that the user can create/update his profile. Currently I have something like: models/db.py

[web2py] Re: How to process a custom register form?

2013-09-08 Thread Apple Mason
: On Friday, September 6, 2013 7:51:54 PM UTC-4, Apple Mason wrote: Oops, I do have form.custom.begin and form.custom.end. I had forgotten to type it here. I also wanted a custom view for the registration, login, and whatever else, so my understanding is that I can do this by using form

[web2py] How to process a custom register form?

2013-09-06 Thread Apple Mason
The default register form has too many fields, so I created a slimmed-down custom one: register.html: div Username: {{=form.custom.widget.username}} Email: {{=form.custom.widget.email}} Password: {{=form.custom.widget.password}} {{=form.custom.submit}} /div default.py: def register():

[web2py] Re: How to process a custom register form?

2013-09-06 Thread Apple Mason
On Friday, September 6, 2013 5:17:23 PM UTC-4, Apple Mason wrote: The default register form has too many fields, so I created a slimmed-down custom one: register.html: div Username: {{=form.custom.widget.username}} Email: {{=form.custom.widget.email}} Password: {{=form.custom.widget.password

[web2py] Help with deploying on nginx

2013-08-29 Thread Apple Mason
I keep getting 502 Bad Gateway, and I'm not sure why. I followed the Nginx deployment recipe on the website, with the following changes: /etc/uwsgi/web2py.xml: Used /var/www-data/web2py/ instead of /home/www-data/web2py/ nginx conf: server_name is my server ip (I don't have a domain name)

[web2py] Re: Help with deploying on nginx

2013-08-29 Thread Apple Mason
-- On Thursday, August 29, 2013 3:10:20 PM UTC-4, Niphlod wrote: what does uwsgi log show ? On Thursday, August 29, 2013 8:18:02 PM UTC+2, Apple Mason wrote: I keep getting 502 Bad Gateway, and I'm not sure why. I followed the Nginx deployment recipe on the website, with the following

[web2py] How to query many to many with three fields?

2013-08-27 Thread Apple Mason
I have this many to many relationship example: db.define_table('location', Field('geom', 'geometry()')) db.define_table('item', Field('name')) db.define_table('item_location', Field('item', db.item), Field('location_one', db.location), Field('location_two', db.location))

[web2py] Re: How to query many to many with three fields?

2013-08-27 Thread Apple Mason
Dienstag, 27. August 2013 19:43:08 UTC+2 schrieb Apple Mason: I have this many to many relationship example: db.define_table('location', Field('geom', 'geometry()')) db.define_table('item', Field('name')) db.define_table('item_location', Field('item', db.item), Field

[web2py] Re: How to query many to many with three fields?

2013-08-27 Thread Apple Mason
, 27. August 2013 21:51:56 UTC+2 schrieb Apple Mason: Hey Alex, Thanks for the suggestion. The problem with the query is that 'location_one.geom.st_equals(point_x_y)' won't work. That's because the table db.item_location doesn't have a field called 'geom'. This is the error

[web2py] using an IDE with web2py

2012-02-06 Thread apple
I am using aptana. I have included the modules and models directories in the pythonpath; and at the top of each python file I have from ide import *. This refers to the file below and is supposed to to stop it marking references to web2py variables as errors and to enable autocomplete. This

[web2py] Re: using an IDE with web2py

2012-02-06 Thread apple
, you shouldn't have to include the T, session, request, response part of your IDE.py, and you'll now get autocomplete for those objects. Anthony On Monday, February 6, 2012 12:30:06 PM UTC-5, apple wrote: I am using aptana. I have included the modules and models directories

[web2py] Re: using an IDE with web2py

2012-02-06 Thread apple
That is odd. Yes I am on trunk and I have checked the gluon __init__.py file and it is exactly as you show above. On Feb 6, 6:34 pm, Anthony abasta...@gmail.com wrote: On Monday, February 6, 2012 1:18:55 PM UTC-5, apple wrote: If I do from gluon import * then it does not find request

[web2py] Re: Is it possible to LOAD a component after a page has rendered?

2012-01-28 Thread apple
web2py_ajax_page(get, URL, null , DIV_ID) This function is included in web2py.js On Jan 28, 10:03 am, scausten scaus...@gmail.com wrote: I'd like to asynchronously load one of a choice of components into a view, based on a user selection after the page has loaded. It's relatively trivial to

[web2py] Re: google code (mercurial) problem

2012-01-23 Thread apple
Worked fine for me yesterday and today via mercurial. 13 revisions in last 3 days. On Jan 23, 2:35 pm, Massimo Di Pierro massimo.dipie...@gmail.com wrote: I messed up something with mercurial and the google code repository has not been updated since Jan 17. The git repository on github should

[web2py] Re: jQuery UI modal form dialog and user function.

2012-01-18 Thread apple
Ah you want the whole URL to be in a dialog. I spent ages figuring this out and the answer is already included in web2py!! You just include the code below and then you can just replace any url with dialog(url) and it will show up in a dialog. Brilliant!! // create dialogbox document.write(div

[web2py] Re: jQuery UI modal form dialog and user function.

2012-01-18 Thread apple
, apple simo...@gmail.com wrote: Ah you want the whole URL to be in a dialog. I spent ages figuring this out and the answer is already included in web2py!! You just include the code below and then you can just replace any url with dialog(url) and it will show up  in a dialog. Brilliant

[web2py] Re: jQuery UI modal form dialog and user function.

2012-01-18 Thread apple
Put the jquery stuff in a file and include it in any view where you want to call the dialog function. The document.write just adds a container for the dialog box. You could just as easily put the html in the page directly but I put it here so that it is all together in one js file which can be

[web2py] Re: jQuery UI modal form dialog and user function.

2012-01-17 Thread apple
In user.html add lines: link href=http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/ themes/{{=response.theme or smoothness}}/jquery-ui.css rel=stylesheet type=text/css / script src=http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/ jquery-ui.min.js type=text/javascript/script script

[web2py] Re: Passing the same object with response from every controller function automatically

2011-12-22 Thread apple
You can put in your model: response.anythingyoulike=something Then in your view {{=response.anythingyoulike}} On Dec 22, 1:12 pm, greenguerilla johngerardoconn...@gmail.com wrote: Hi, I have a search form which I wish to appear on every page. I would rather define this programatically than

[web2py] Re: Combine SQLFORM and SQLFORM.grid?

2011-12-21 Thread apple
, There has been discussion about manipulating grid.  Search for threads containing form.create() Also perhaps Anthony will chime in.  He knows this stuff pretty well. apple, Surely the grid is just a grid and does not have a submit button?  SQLFORM.grid is much more than that. http

[web2py] Re: Combine SQLFORM and SQLFORM.grid?

2011-12-21 Thread apple
way e.g. if your edit form has a count of the rows on the grid then you might want to refresh it. Thats it!!! On Dec 21, 8:03 pm, apple simo...@gmail.com wrote: I have done something similar to what you are looking for but it was a little fiddly in places (if someone can suggest a better way I

[web2py] Re: Combine SQLFORM and SQLFORM.grid?

2011-12-20 Thread apple
to concatanate these two forms? 2011/12/19 Cliff cjk...@gmail.com Martin, There has been discussion about manipulating grid.  Search for threads containing form.create() Also perhaps Anthony will chime in.  He knows this stuff pretty well. apple, Surely the grid is just a grid and does

[web2py] Re: Combine SQLFORM and SQLFORM.grid?

2011-12-19 Thread apple
Surely the grid is just a grid and does not have a submit button? Do you mean that you have a grid linked to a form and you want to refresh it when the form is submitted? On Dec 18, 9:10 pm, Martin Weissenboeck mweis...@gmail.com wrote: Hi, I have one form created with SQLFORM and another form

[web2py] Re: Speed of JOIN vs Recursive SELECTs

2011-12-03 Thread apple
If it is only slow the first time the page is loading then maybe it is a web page issue rather than a database issue. You can easily look at how long each component took to load. In Chrome this is in the javascript console (ctrl-shift-J) and network tab. In Firefox it is in Firebug under the net

[web2py] Re: call submit from an A tag

2011-11-30 Thread apple
You can do this or equivalent using web2py helpers: a class=button onclick=$(this).prevAll('form').submit();\Submit/ a On Nov 30, 3:15 pm, thodoris pasxi...@gmail.com wrote: Is there a way to change the submit button into clickable text? Lets say i have this form: form =

[web2py] Re: How to check a value in a dictionary entry in template?

2011-11-27 Thread apple
{{=myvariable}} outputs myvariable to the page. You just need to refer to the variable. Here is an example: {{if default_fields['job_title']:}} divthe job title is /div{{=default_fields['job_title']}} {{pass}} The first one checks the value. The second outputs to the page. On Nov 27, 9:22 am,

[web2py] how to install python egg within a web2py application

2011-11-17 Thread apple
I am using pisa to generate a pdf and it requires html5lib and reportlab. This all works fine when installed within python27. I want to move this to the web2py application to make it self contained. I moved the pisa and reportlab directories into myapp/ modules and everything worked fine. However

[web2py] Re: how to install python egg within a web2py application

2011-11-17 Thread apple
Will answer myself just in case anyone has same problem - Just use any unzip program to unzip the egg into modules. On Nov 17, 10:28 am, apple simo...@gmail.com wrote: I am using pisa to generate a pdf and it requires html5lib and reportlab. This all works fine when installed within python27

[web2py] Re: Resetting the database

2011-11-14 Thread apple
Web2py tries to redefine tables in line with changes in the model file but sometimes this is not possible with sqlite. Therefore you may want to delete the table definitions as well. If you do want a clean sheet of paper then do this: exclude=[] import os import glob import sys

[web2py] ajax upload of files

2011-11-13 Thread apple
The book says: *Please note:* Because Ajax post does not support multipart forms, i.e. file uploads, upload fields will not work with the LOAD component. You could be fooled into thinking it would work because upload fields will function normally if POST is done from the individual

[web2py] redirected post requests and the validate function using post_vars

2011-11-10 Thread apple
The validate function uses current.request.post_vars. However when you redirect a submitted form it becomes a get rather than post and request.post_vars is empty. Is there any reason why it is not just current.request.vars?

[web2py] Re: question about include file

2011-11-06 Thread apple
it)? Anthony On Saturday, November 5, 2011 8:49:46 PM UTC-4, apple wrote: I have a view which works as expected: {{extend 'layout.html'}} {{include 'crm/files.html'}} {{include 'crm/dialog.js'}} a class=button onclick=javascript: createdialog('edit.html/ todo')\Submit

[web2py] question about include file

2011-11-05 Thread apple
I have a view which works as expected: {{extend 'layout.html'}} {{include 'crm/files.html'}} {{include 'crm/dialog.js'}} a class=button onclick=javascript: createdialog('edit.html/ todo')\Submit/a However if I move the line {{include 'crm/dialog.js'}} to the end of the file crm/files/html then I

[web2py] moving calendar dialog to the front

2011-11-05 Thread apple
I have some jquery that shows a web2py view in a dialog box instead of on a new page. This calls web2py_ajax_init() to enable the calendar widget when you click on a date field. However the calendar widget dialog appears underneath my dialog box. Is there a way I can move it to the front?

[web2py] Re: A SQLFORM.grid question

2011-11-03 Thread apple
My mistake. I tend to redirect because I need some extra processing but grid does actually produce a basic edit form. If you do use the grid generated form then the submit should work as normal though. You should check where it is failing - e.g. when you press submit is it actually calling the

[web2py] Re: Confused about hidden fields

2011-11-02 Thread apple
Instead of form.accepts() you can use form.validate() and then do your own update. Then you do not need to pass unnecessary variables to the view and back again. form = SQLFORM(table, id) if form.validate(): form.vars.mysecretvariable=whatever I want if not form.errors:

[web2py] Re: A SQLFORM.grid question

2011-11-02 Thread apple
SQLFORM.grid does not actually add the records automatically. It just calls the grid controller with args action/table. You have to do something like: if request.args(0) in (edit, new): redirect(URL(edit.html, args=[request.args(1), request.args(2)]) On Nov 2, 9:15 am, Mike Veltman

[web2py] Re: putting a condition in a form

2011-10-30 Thread apple
http://web2py.com/book/default/chapter/10#Conditional-Fields-in-Forms On Oct 30, 9:30 pm, mart msenecal...@gmail.com wrote: Hi, does anyone know if I can have some sort of condition in a form (but BEFORE the form is submitted)? For example, lets say I have 5 fields in a form where depending

[web2py] Re: SQLFORM.grid behavior with an empty table

2011-10-28 Thread apple
This is fixed in trunk. On Oct 28, 1:44 am, Bob St John bobinco...@gmail.com wrote: using 1.99.2 SQLFORM.grid... I don't see the need for this statement... line 1641: if not searchable and not rows: return DIV(T('No records found')) If it was removed a user would see an empty grid

[web2py] Re: From html view to pdf.

2011-10-25 Thread apple
Very easy using pisa. You also need to install reportlab and html5lib but once these have been installed it is simple: # to directly get the html for a view html = response.render(myview.html, locals()) filename = C://outputpdf.pdf f = file(filename, wb)

[web2py] dal aggregation sum fields None

2011-10-22 Thread apple
I am summing some data using the DAL: cash_price = db.orderline.cash_price.sum() lines = db(db.orderline.order_ == id).select(cash_price).first() However if there are no lines then lines[cash_price] is None. So I added: lines[cash_price]=lines[cash_price] or 0 But this does not

[web2py] In a grid is it possible to represent a filename as a link to the file?

2011-10-20 Thread apple
In my model I have: db.customerfile.filename.represent= lambda filename, row: \ A(filename, _href=URL('download', args=row.file)) db.customerfile.file.readable=False db.customerfile.file.writable=False In a SQLFORM this shows the filename as a link

[web2py] uploading files to the database

2011-10-20 Thread apple
I am now experimenting with uploading files to the database but have not been successful and have some questions: 1) Field('file','upload', uploadfield='fileblob'), I understand this is supposed to create the fileblob field automatically. However it does not seem to do this for me. Does it not

[web2py] is it form.validate() or form.validate().accepted

2011-10-19 Thread apple
There are two examples in the book that use if form.validate().accepted However I get an error with this. Should it be just if form.validate() ?

[web2py] closed issues on google code

2011-10-17 Thread apple
On google code bug tracker do comments added to closed issues get read? Or is it necessary to open a new issue? e.g. issue 462 was incorrectly marked invalid. I have added a further comment to the closed issue with correction needed. But not sure if it will be noticed?

[web2py] populate not working with validators

2011-10-13 Thread apple
Populate does not seem to work at all with validators. The code seems to be written to take account of field length and definition. However it looks at field.requires.options. Yet field.requires is a list of validators. I am guessing that validators have been around for a long time. In which case

[web2py] Re: two SQLFORM.grid in one view?

2011-10-12 Thread apple
, Massimo Di Pierro massimo.dipie...@gmail.com wrote: If an ajax grid does work please open an issue on google code so I can check it and we can fix it. I cannot reproduce your problem otherwise. On Oct 11, 1:12 pm, apple simo...@gmail.com wrote: Surely there must be a solution

[web2py] Re: re populate

2011-10-12 Thread apple
Is this a bug then? I have tried string and text fields; specifying length and using IS_LENGTH. In every case it seems to generate strings longer than specified. On Oct 11, 4:30 pm, Anthony abasta...@gmail.com wrote: On Tuesday, October 11, 2011 10:49:59 AM UTC-4, apple wrote: Have just

[web2py] Re: two SQLFORM.grid in one view?

2011-10-12 Thread apple
=test2.load, args=[customer], ajax=True, ajax_trap=True)}} test2.load {{=grid}} On Oct 12, 2:25 pm, Massimo Di Pierro massimo.dipie...@gmail.com wrote: Please show us the code (the man and two controllers). On Oct 12, 3:09 am, apple simo...@gmail.com wrote: Have updated issue 454 which

[web2py] re populate

2011-10-11 Thread apple
Have just started using populate which is a really useful tool. However I have a couple of questions: 1) It seems to ignore the length specified for string fields. For example it fills my postcode field with 100 characters of text despite it having length of 8. Is there a way of restricting the

[web2py] Re: two SQLFORM.grid in one view?

2011-10-11 Thread apple
Surely there must be a solution to this? It does not seem logical to have a component that is arbitrarily restricted to one per page? iframe is not a good solution. And I don't think LOAD with ajax works with multiple grids and pagination - certainly it does not work in my application even after

[web2py] Re: two SQLFORM.grid in one view?

2011-10-11 Thread apple
with paginate. Would it not be more consistent to pass the tablename with all the buttons? On Oct 11, 7:12 pm, apple simo...@gmail.com wrote: Surely there must be a solution to this? It does not seem logical to have a component that is arbitrarily restricted to one per page? iframe is not a good

[web2py] how can I get a class from a model file

2011-10-08 Thread apple
tableclass=getattr(tableclasses, tablename) Works fine when tableclasses is in modules but not when it is in models - says global name tableclasses is not defined. Is it possible to access by name a class defined in models?

[web2py] Re: how can I get a class from a model file

2011-10-08 Thread apple
To answer my own question models are executed and not imported so are already in the globals namespace. Therefore instead of using getattr one can use: globals()[tablename]() On Oct 8, 5:57 pm, apple simo...@gmail.com wrote: tableclass=getattr(tableclasses, tablename) Works fine when

[web2py] Re: Overriding Grid/Smartgrid's 'Edit/Delete/View'

2011-10-06 Thread apple
You can add your own buttons using: links = [lambda row: A('Edit',_href=URL(controller,edit, args=[update, tablename, a.id])) and set editable, deletable, details to False. On Oct 6, 12:48 pm, Johann Spies johann.sp...@gmail.com wrote: How do I override the views/controllers  triggered by

[web2py] is it possible to update the html using elements?

2011-10-06 Thread apple
web2py elements allows me to parse the dom; change attributes; and insert elements. But is it possible to remove elements entirely or to replace elements with new html? e.g. I can hide the buttons in a grid by doing this: pagination=grid.elements('.web2py_paginator') if pagination:

[web2py] Re: Overriding Grid/Smartgrid's 'Edit/Delete/View'

2011-10-06 Thread apple
, Oct 6, 2011 at 9:36 AM, apple simo...@gmail.com wrote: You can add your own buttons using: links = [lambda row: A('Edit',_href=URL(controller,edit, args=[update, tablename, a.id])) and set editable, deletable, details  to False. On Oct 6, 12:48 pm, Johann Spies johann.sp...@gmail.com

[web2py] grid signature

2011-10-05 Thread apple
I have a controller that tailors the grid for a table - setting the fields, query, orderby and args parameters depending on the table requested. My problem is that the CSV and paginate request formats do not contain the tablename in request.args or request.vars. So I am unable to configure my grid

[web2py] Re: can i import db into module?

2011-09-29 Thread apple
I also want to know the answer to this. I have followed an example but could not get it to work. In model I have: from globals import current from gluon.storage import * current.app=Storage() current.app.db=db If I put in my module X: from globals import current then it says no module named

[web2py] issues with multiple grids on a page

2011-09-28 Thread apple
A couple of issues with the new grid. In particular I have a page that includes a customer form and multiple grids on the same page: 1) Clear buttons for each list clears the first search box on the page. 2) Add button passes the table name but not the other args. I want to pass the customerid

[web2py] Re: table, grid, smartgrid, getting better

2011-09-27 Thread apple
There seem to be a few wrinkles to iron out. If I set the links parameter it seems to make no difference to the behaviour. If I set deletable=True then I get a delete button but the link does not contain an id and does not delete the record automatically. On Sep 27, 2:40 pm, Massimo Di Pierro

[web2py] suggestion re folders in web2py

2011-09-27 Thread apple
I sometimes have to remind myself which files in an application are my files versus web2py files. In particular this becomes an issue with upgrades. It is not clear when the web2py files in applications have been updated. For example the latest release has made changes to files and added files to

[web2py] Re: table, grid, smartgrid, getting better

2011-09-27 Thread apple
.  That is the default. What are you setting for your links parameter?      -Jim On 9/27/2011 11:17 AM, apple wrote: There seem to be a few wrinkles to iron out. If I set the links parameter it seems to make no difference to the behaviour. If I set deletable=True then I get

[web2py] setting blank date in new widget

2011-09-27 Thread apple
The new date/time widgets do not seem to have an option to set a blank date/time. Once you have clicked on the date field you have to set a date. Backspace and delete keys have no effect. Is there a way to leave the date field blank or to delete a date?

[web2py] Re: table, grid, smartgrid, getting better

2011-09-26 Thread apple
This grid is fantastic! Is there some documentation? Some specific questions: 1) I am setting fields to be displayed based on a configuration file. However if you use the navigation buttons to go to second page then it calls the controller with a signature and the table name is no longer in

[web2py] load restricted errors

2011-09-24 Thread apple
I have a loop in a view that loads a set of components (see code below). However if one of the components fails then I get a restricted error and the line number is the line of the LOAD command so I do not even know which component failed let alone the real error message and line number. Is using

[web2py] Re: load restricted errors

2011-09-24 Thread apple
I am loading 12 components. The error message restricted error on the LOAD line is unhelpful. It does not tell me which component has failed. Today it is one component, another day it may be another. Of course I can amend the code to try one component at a time and then do what you suggestis

[web2py] Re: load restricted errors

2011-09-24 Thread apple
I can do that then load the component separately to test it as you suggested. But it still feels a bit wrong. Why can't web2py tell me where the error has occurred? On Sep 24, 7:37 pm, pbreit pbreitenb...@gmail.com wrote: Can you print each component name? Maybe like: {{for component in

[web2py] possible bug in LOAD with ajax=false

2011-09-24 Thread apple
When call singleview and submit the form it should print singleview, edit, edit. However it prints singleview, edit, singleview, edit. Why is the submit not trapped and sent via ajax to the edit controller? controller. def edit(): print(edit) table=db[customer]

[web2py] what other tools do you use with web2py

2011-09-10 Thread apple
The two best things about web2py: Ability to achieve a lot with a very small number of lines of code Being able to use python in the view templates The worst thing: Finding that 2/3 of the time is now spent on jquery and CSS! What tools are there to make this easier? Are

[web2py] Re: crud not updating

2011-08-30 Thread apple
changes by user 1 in SQLFORM it is disabled by default. In crud it is enabled by default. crud.settings.detect_record_change = True Still something is wrong because you should get a message about it. On Aug 28, 2:18 pm, apple sim...@gmail.com wrote: If the database fails to update

[web2py] Re: crud not updating

2011-08-29 Thread apple
emailed you a package anthony. Can't get much simpler than this. I don't get it. The second crud.update call is made with the same parameters, same session but gets a different result. CONTROLLER def onaccept(form): print(accepted) def test(): print(request.vars) print(request.args)

[web2py] crud not updating

2011-08-28 Thread apple
If the database fails to update within CRUD is there a way I can view the error? I have a controller with this code that works fine: form=SQLFORM(table,a.id) if form.accepts(request.vars, session): response.flash=record updated I replace it with:

[web2py] Re: crud not updating

2011-08-28 Thread apple
. What would cause the formkey to be the same? There is a long pause and some typing between the two submits so it is not an accidental double click. On Aug 28, 8:18 pm, apple simo...@gmail.com wrote: If the database fails to update within CRUD is there a way I can view the error? I have

  1   2   >