[web2py] Where to add custom validators

2016-05-09 Thread Pierre-Antoine Roiron
Hi ! I am using custom validators that I add to the validators.py file. Unfortunately, It' overwritten at each upgrade of web2py. Is there a file inside my site inside which I could put these custom validators ? Thank you for your help. -- Resources: - http://web2py.com -

[web2py] Re: manual form and SQLFORM question

2015-12-20 Thread Pierre-Antoine Roiron
Hi, could it be that you don't increment your ? I think that html doesn't care, but when passing it to python ? -- 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

[web2py] Re: nested reference fields in IS_IN_DB validator

2015-12-16 Thread Pierre-Antoine Roiron
Here's what I had in mind, if of any interest. This function does not work (and it's a simplified one that dosn't take into account the multiple=True in db.customer.guitar_ref). I'm not sure why it dosn't work. I think it's because I call a function in the first arg of IS_IN_DB. If someone

[web2py] compute using a variable for a field name (db.table.fieldname)

2015-12-16 Thread Pierre-Antoine Roiron
Hi, I have a function that works well and helps to compute the sum of fields referenced by a list:reference field in another table : table 'line' with field: 'price','double' table 'invoice' with fields: 'line_id', 'list:reference' 'total','double' def sum_total(row): t=0 for

[web2py] Re: compute using a variable for a field name (db.table.fieldname)

2015-12-16 Thread Pierre-Antoine Roiron
I nailed it... and I am ashamed : > for id_line in row.line_id: t=t+db.line[id_line][line_field_name] > and not for id_line in row.line_id: t=t+db.line[line_field_name][id_line] -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py

[web2py] Re: How to hide certain fields from the table in the form?

2015-12-15 Thread Pierre-Antoine Roiron
Use FIeld descriptor 'readable' and 'writable in the Field definition, or added later using db.my_field.writable=False. It's in the book : http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer?search=writable%3D You can also make a custom controller to get a form/view

[web2py] Re: nested reference fields in IS_IN_DB validator

2015-12-15 Thread Pierre-Antoine Roiron
I want to write something like that, but I know it's not correct because it doesn't provide the link between the invoice._id considered and c_id : c_id=db.invoice.customer_ref g_id=db.customer[c_id].guitar_ref db.invoice.guitar_ref.requires=IS_IN_DB(db(db.guitar._id==g_id),'guitar.id') --

[web2py] Re: nested reference fields in IS_IN_DB validator

2015-12-15 Thread Pierre-Antoine Roiron
OK, that's the problem discussed in the "Validators with dependencies" paragraph of the book. It took me some time to realize that. From what I've read from other developers, it's not possible to solve this in the model if I understand well, even if the book says so. I'll solve this by adding

[web2py] Re: nested reference fields in IS_IN_DB validator

2015-12-15 Thread Pierre-Antoine Roiron
This is my latest best try, but it still returns a syntax error when executing (not when compiling) : db.define_table('guitar', Field('brand',type='string')) db.define_table('customer', Field('name',type='string'),

[web2py] nested reference fields in IS_IN_DB validator

2015-12-14 Thread Pierre-Antoine Roiron
Hi, I'm stuck so I think I'll ask some help, considering the ususal searches in this group and book don't help enough considering my beginner level. I'll try to summarize my problem: I'm writing an app to make quotes and invoice for my business which is repairing and making guitars.

[web2py] Re: Contribution to validators

2015-12-09 Thread Pierre-Antoine Roiron
I seems like I forgot to add IS_TITLE() to the __all__ declaration or whatever is its name in validators.py (I am not an developer, sorry for the inapropriate vocabulary). It seems to work for now. I am still open to some explanations (what is validators.pyc). -- Resources: -

[web2py] Re: web2py - on ubuntu 12.04 vps.net

2015-12-09 Thread Pierre-Antoine Roiron
This script is for ubuntu 14.04, not 12.04. Nothing stroke me but I could be missing something. Did you try sudo service apache2 restart -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) -

[web2py] Re: web2py - on ubuntu 12.04 vps.net

2015-12-09 Thread Pierre-Antoine Roiron
Did it returned any error or warning while executing? -- 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

[web2py] Re: web2py - on ubuntu 12.04 vps.net

2015-12-09 Thread Pierre-Antoine Roiron
Did it returned any error or warning while executing? -- 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

[web2py] Re: web2py - on ubuntu 12.04 vps.net

2015-12-09 Thread Pierre-Antoine Roiron
Cam you check that default.conf is in /etc/apache2/site-enable/, and that it contains references to web2py? -- 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)

[web2py] Contribution to validators

2015-12-08 Thread Pierre-Antoine Roiron
Hi, I'm working on a web2py project, and I'm slowly learning. Thanks for all the ressources available. I needed a new DAL validator like IS_UPPER() but based on title(), so I looked over the source files and saw validators.py. I added the class IS_TITLE() to it but it doesn't seems to be enough

[web2py] Using _format in represent=lambda id, row...

2012-06-17 Thread Pierre-Antoine Roiron
Hi, I don't understand why considering the usual : db.define_table (person, Field('name'),format='%(name)s') db.define_table (dog, Field('name'),Field('owner_id',db.person) Using this is okay : db.dog.owner_id.represent=lambda id,row:db.person(id).name But using this fails :

[web2py] displaying a computed field

2011-09-01 Thread Pierre-Antoine Roiron
computed, providing the price, but as soon as I add the compute attribute, the price_with_taxes field is no more displayed by the database admin form. Am I missing something? Why isn't the field displayed? Thank you for any help. -- Pierre-Antoine ROIRON ARTISAN LUTHIER 37, rue Sébastien Gryphe