[web2py] Re: trouble with request.var.checkbox list

2017-03-30 Thread Frank Claessen
Thx for clarifying Anthony. Regards Frank -- 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 Goo

[web2py] Re: How to format the result of a sum()

2017-03-30 Thread 黄祥
pls try in views *e.g.* *for float :* {{=DIV('Rp. %s' % (locale.format("%.2f", total_sum_sales, grouping = True) ) ) }} *for integer* {{=DIV('%s' % (format(total_sum_sales, ",d").replace(",", ".") ) ) }} best regards, stifan -- Resources: - http://web2py.com - http://web2py.com/book (Documentat

[web2py] How to format the result of a sum()

2017-03-30 Thread mkerins
How does one apply formatting to a field which is not defined in a table, but rather the result of a sum() operation? Below, the field 'price' is formatted in the table definition as currency, and displays in forms with appropriate currency symbol and thousands separators. However, after the

[web2py] Re: smartgrid with linked_tables and constraints broke the links

2017-03-30 Thread Dave S
On Thursday, March 30, 2017 at 2:57:09 PM UTC-7, Rudy wrote: > > Thanks Anthony for your explanation of request.args use with smartgrid, I > tried your suggestion, but had the same error. I think i made a mistake in > the constraints in my earlier post (according to the documentation, > constr

[web2py] Re: auth_user referencing customer table AND linked_tables link broke when constraints was used issues

2017-03-30 Thread Rudy
Hi Anthony, thanks again for taking time out to explain and answered below questions. I did define the customer table before auth tables were created and used lazy_tables=False, it works this time when I put all the tables in a single database without using CAS (i do need to share group/membersh

[web2py] Re: smartgrid with linked_tables and constraints broke the links

2017-03-30 Thread Rudy
Thanks Anthony for your explanation of request.args use with smartgrid, I tried your suggestion, but had the same error. I think i made a mistake in the constraints in my earlier post (according to the documentation, constraints is a dict of tablename:query), here is what i have changed. invoic

[web2py] Re: Pagination, only add var if it already exists?

2017-03-30 Thread r
My code for the pagination (next button) Next If there is a name, it will add it to the url however if there is no name, it will add "none". Instead if it doesn't exist I don't want it to add anything, just the page. On Thursday, 30 March 2017 16:34:28 UTC+1, Anthony wrote: > > It is not quit

Re: [web2py] Pagination, only add var if it already exists?

2017-03-30 Thread r
I'm not quite sure, so would I do something like this? controller session.varName = request.var.name html: if session.varName: | Next like that ? On Thursday, 30 March 2017 15:51:00 UTC+1, Áureo Dias Neto wrote: > > example: > > use -> session.nome = 'teste'to store on the variable nome o

[web2py] Re: login form

2017-03-30 Thread Dave S
To expand on Anthony's reference, I'd start at the beginning of the book with http://web2py.com/books/default/chapter/29/03/overview#Adding-authentication> for a very simple example. On Thursday, March 30, 2017 at 12:55:56 PM UTC-7, Happy Rob wrote: > > This is a quick one here, It's (extremely)

[web2py] Re: login form

2017-03-30 Thread Happy Rob
This is a quick one here, It's (extremely) ugly and basic, but should give you a framework to figure out from. I did it on pythonanywhere for free which is pretty cool. The template below should work on local or others though. No email out or $ because the pythonanywhere free version doesn't all

Re: [web2py] Re: db().select() and db.executesql() quetstion

2017-03-30 Thread Richard Vézina
Thanks Anthony, I should use rows... I had investigate that with help postgresql log and as you said DAL does queried the database at the assignation of the db select or executesql... Richard On Thu, Mar 30, 2017 at 12:17 PM, Anthony wrote: > No, the database is queried when you call the .sel

[web2py] Re: db().select() and db.executesql() quetstion

2017-03-30 Thread Anthony
No, the database is queried when you call the .select() or .executesql() method. The former returns a Rows object and the latter a list of tuples, so when you loop over your "query" object (which is confusingly named), you are simply looping over a Python data structure. Anthony On Thursday, M

[web2py] db().select() and db.executesql() quetstion

2017-03-30 Thread Richard
Hello, I would like to clarify how DAL handle backend query. For instance, if I assign a db().select() or executesql to a var like so : query = db().select() or query = db.executesql() Is the backend query occurs then or it occurs when I use the query var in a for loop for instance. And if

Re: [web2py] Pagination, only add var if it already exists?

2017-03-30 Thread Anthony
On Thursday, March 30, 2017 at 10:51:00 AM UTC-4, Áureo Dias Neto wrote: > > example: > > use -> session.nome = 'teste'to store on the variable nome of the > session of actual logged user.. > > and in the controller you can call the value of variable you have stored > This might now be the b

[web2py] Re: Pagination, only add var if it already exists?

2017-03-30 Thread Anthony
It is not quite clear what you are asking. Please show some code. Anthony On Thursday, March 30, 2017 at 10:41:50 AM UTC-4, r wrote: > > Hi, so my index page is like this: /index?page=1 I'm using pagination, > when the user clicks on the next page, it should become: /index?page=2 > > However if

[web2py] Re: auth_user referencing customer table AND linked_tables link broke when constraints was used issues

2017-03-30 Thread Anthony
> > 1st question: i want to use auth_user table to store my internal staffs > and external customers info, so that I can leverage all the built-in > authentication and authorisation functions provided by web2py out of the > box (please let me know if I should not do that). I added some fields i

Re: [web2py] Pagination, only add var if it already exists?

2017-03-30 Thread Áureo Dias Neto
example: use -> session.nome = 'teste'to store on the variable nome of the session of actual logged user.. and in the controller you can call the value of variable you have stored 2017-03-30 11:47 GMT-03:00 r : > Forgot about that one, I'll read the documentation and try it out later. > Th

Re: [web2py] Pagination, only add var if it already exists?

2017-03-30 Thread r
Forgot about that one, I'll read the documentation and try it out later. Thanks On Thursday, 30 March 2017 15:45:23 UTC+1, Áureo Dias Neto wrote: > > hello, > > why note use session object? > > 2017-03-30 11:41 GMT-03:00 r >: > >> Hi, so my index page is like this: /index?page=1 I'm using paginat

Re: [web2py] Pagination, only add var if it already exists?

2017-03-30 Thread Áureo Dias Neto
hello, why note use session object? 2017-03-30 11:41 GMT-03:00 r : > Hi, so my index page is like this: /index?page=1 I'm using pagination, > when the user clicks on the next page, it should become: /index?page=2 > > However if there is another var in the URL, it should carry that too > > /index

[web2py] Pagination, only add var if it already exists?

2017-03-30 Thread r
Hi, so my index page is like this: /index?page=1 I'm using pagination, when the user clicks on the next page, it should become: /index?page=2 However if there is another var in the URL, it should carry that too /index?page=1&name=test becomes /index?page=2&name=test At the moment, I've done i

[web2py] Re: smartgrid with linked_tables and constraints broke the links

2017-03-30 Thread Anthony
> > def view_invoices(): > customer_id = request.args(0) > if customer_id: > invoice_query=db.invoice.customer==customer_id > else: > invoice_query=db.invoice.customer!=None > constraints=dict(invoice=invoice_query) > db.item.invoice.writable=False #avoid invoi

[web2py] Re: 'numpy.ndarray' object has no attribute 'lower'

2017-03-30 Thread Anthony
On Thursday, March 30, 2017 at 12:33:01 AM UTC-4, Nitish kumar wrote: > > I am doing text classification using scikit and numpy but i am getting > this error. > 'numpy.ndarray' object has no attribute > 'lower' > Always show your code and the full traceback. Without that, we can't help much,

[web2py] Re: appconfig.ini versus models/0.py

2017-03-30 Thread Anthony
The wizard was created before appconfig existed, and it looks like it was never updated. Feel free to open a Github issue and link back to this thread. Anthony On Thursday, March 30, 2017 at 12:33:07 AM UTC-4, Jared Priddle wrote: > > Hi guys, > > I created a new application with the wizard and

[web2py] Re: trouble with request.var.checkbox list

2017-03-30 Thread Anthony
On Thursday, March 30, 2017 at 6:17:25 AM UTC-4, Frank Claessen wrote: > > Thx Nico, > > I just figured out that it is indeed a string. However, as soon as I > select more than 1 row, it becomes a list. I was under the assumption that > it is always a list - appears not to be true. > > Perhaps a

[web2py] Re: Social network plug-in

2017-03-30 Thread Anthony
db(query) returns a Set object. The Set class has a __call__ method . In Python, when a class has a __call__ method, instances of the class are *callable*, meaning they can be treated like func

[web2py] Re: Referencing a table which is referencing some other table.

2017-03-30 Thread Anthony
When you create a reference field, if the referenced table has a "format" attribute, then the reference field will get a default IS_IN_DB validator (which is used to construct the SQLFORM dropdown) and a default "represent" attribute. Otherwise, you will have to create those yourself. So, just a

[web2py] Re: login form

2017-03-30 Thread Anthony
On Thursday, March 30, 2017 at 8:32:00 AM UTC-4, karimhayda...@gmail.com wrote: > > hello > i am new in web2py and also in MVC framework. > i want to build a simple login form (username+password) > > How to build a form + data base?? > You should start by reading the documentation

[web2py] login form

2017-03-30 Thread karimhaydar31
hello i am new in web2py and also in MVC framework. i want to build a simple login form (username+password) How to build a form + data base?? help me plz best regards karim -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source cod

[web2py] Referencing a table which is referencing some other table.

2017-03-30 Thread akshay055kumar
Suppose i have 3 tables: db.define_table('testbed', Field('name'), Field('alias_name'), Field('author',db.auth_user,default=auth.user_id,readable=False,writable=False), format='%(name)s') db.define_table('device', Field('name',unique=True,notnull=True), Field('alias_name

[web2py] Permission denied: '/var/lib/web2py/applications/admin/private/hosts.deny'

2017-03-30 Thread Nicola Gramola
Hello. I've installed web2py with Apache 2.4 and mod_wsgi in a RedHat distribution. When I try to conect /admin system rease error [Errno 13] Permission denied: '/var/lib/web2py/applications/admin/private/hosts.deny' The hosts file have all permissions Thanks Virtual Host conf ... WSGIDae

[web2py] Re: dynamic extending of views?

2017-03-30 Thread Anthony
It's not quite clear what you are trying to do. Can you show some sample code? When you say you have three variants of a block, can you not use the {{block}} functionality or some conditional logic in the base? Note, if you don't plan to compile views, you can use a variable or other Python exp

[web2py] dynamic extending of views?

2017-03-30 Thread Jurgis Pralgauskis
Hi, if I have 2 base views: base1.html base2.html and I have 3 variants to ovveride same block: A B C Can I dynamically generate extended view, sth like: render( dyn_view(base, ovverride) , dict_vars ) As I feel the standardt way is a bit clumsy: base1A.html base1B.html base1C.html ba

[web2py] Re: trouble with request.var.checkbox list

2017-03-30 Thread Frank Claessen
Thx Nico, I just figured out that it is indeed a string. However, as soon as I select more than 1 row, it becomes a list. I was under the assumption that it is always a list - appears not to be true. Perhaps a suggestion to use one single format - list?? Regards Frank p.s. I really enjoy us