In web2py SQLFORM grid, numbers are shown unformatted and left-aligned. It will be better if the numbers or money values are currency formatted, to make it easier to read. And better yet if those numbers right-aligned in the grid / table. We can use represent in models to do the job, like:
At some point in doing web application using web2py/Python I need to show numbers in money formatted string. Seems a little problem easy to handle, at first. After searching about money at Python Package Index then I know it was quite complex matter involved many things…
Anyway, the money format for my purpose it is enough to use simple function to convert number to money formatted string, and I use “moneyfmt” recipe I found at Python Docs, modified it a little, set places=0 as default, add condition if places == 0 to automatically set dp='' if places=0, so I don’t have to set “dp” parameter when I need to change the number of “places”.
We can fill a field based on another field, for example to calculate/compute a total value.
return request.vars.in_time + request.vars.duration ##
Field('duration', 'integer'), Field('end_time','datetime', compute = _compute))
Pagi ini dalam perjalanan ke bandara, saya melihat ada dua spanduk himbauan yang penting…
Spanduk pertama mengenai “gelandangan pengemis di lampu lalu lintas” atau “gepeng lampu merah”. Spanduk yang menghimbau untuk tidak memberi apa pun kepada mereka, tapi akan ada orang yang memberi dengan alasan kasihan, khawatir kendaraannya ‘diapa-apain’, atau supaya pengemis itu secepatnya pergi.
Dan, kelihatannya aparat selalu kalah dalam permainan petak umpet ini. Karena selalu muncul dan muncul lagi…
I need to install a Java Servlet Server on my Macbook, and I could not find a one-click installer for OS X 🙂
Search the internet for finding the shortest way to install it, and take note for myself, maybe someone will also need this and hope it helps.
I use Credit Card mostly for iTunes, Paypal, and other ordinary secure internet transactions. For domestic or “offline” transactions, I prefer doing cash or ATM transfer (actually, domestic Internet Banking).
About three weeks ago I activated a new Visa Credit Card, and added to iTunes Store and Paypal. It worked fine for some internet transactions. But then, about a week ago iTunes Store said can not charge my new CC. I canceled the transaction and thought due to overlimit problem, which was not.
Then, I tried to check out at Worldpay, and this transaction gave me a clue: Your Visa Credit Card is not activated. Please contact your bank at xxx.xxxx.xxxx
Beside the preinstalled Safari which I keep it updated, I also installed the other major web browsers: Firefox 5, Chrome latest beta (not the development one), and Opera the latest, currently version 11.50. There’s no Internet Explorer yet available for Mac, which I would install if only it existed 😀