[web2py] Re: How can I make a calculation in the view?

2016-05-19 Thread greenpoise
I see. Thanks Anthony On Thursday, May 19, 2016 at 3:09:52 AM UTC-7, Anthony wrote: > > Though generally it is good to minimize the logic in views, as they are > more difficult to read, test, and debug. So, prefer moving such > calculations to the controller, or at least to a function that is

[web2py] Re: How can I make a calculation in the view?

2016-05-19 Thread greenpoise
Thanks a million. On Wednesday, May 18, 2016 at 10:11:40 PM UTC-7, 黄祥 wrote: > > just do like usual in controller > e.g. > *controllers/default.py* > def report_investor(): > choose_investor = request.args(0) > # query > query_account = (db.account.investor == choose_investor) > > # row > rows_a

[web2py] Re: How can I make a calculation in the view?

2016-05-19 Thread Anthony
Though generally it is good to minimize the logic in views, as the are more difficult to read, test, and debug. So, prefer moving such calculations to the controller, or at least to a function that is simply called from the view. Anthony -- Resources: - http://web2py.com - http://web2py.com/bo

[web2py] Re: How can I make a calculation in the view?

2016-05-18 Thread 黄祥
just do like usual in controller e.g. *controllers/default.py* def report_investor(): choose_investor = request.args(0) # query query_account = (db.account.investor == choose_investor) # row rows_account = db(query_account).select(orderby = ~db.account.id) return dict(rows_account = rows_account)