[web2py][ANN] ago.py integration to web2py of ago lib (human readable timestam) to allow use of T()

42 views
Skip to first unread message

Richard

unread,
Oct 18, 2013, 12:05:28 PM10/18/13
to web...@googlegroups.com

Massimo Di Pierro

unread,
Oct 18, 2013, 1:04:09 PM10/18/13
to web...@googlegroups.com
There is also 

from gluon.tools import prettydate

Richard Vézina

unread,
Oct 18, 2013, 1:44:48 PM10/18/13
to web2py-users
Hello,

Ok, I did see some thread with the name passed, but didn't know it was for that usage.

Here example : 

I think, I will go with it...

If you want you can include ago.py in contrib if it good enough...

:)

The orginal code is stated as Public Domain : https://bitbucket.org/russellballestrini/ago/src

Richard


--
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 Google Groups "web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to web2py+un...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Richard Vézina

unread,
Oct 18, 2013, 1:56:03 PM10/18/13
to web2py-users
Doesn't support postgres timezone neither though :

Maybe this example could be added in the book :

import datetime
from gluon.tools import prettydate
db.table_name.field_name.represent = lambda value, row: prettydate(value.replace(tzinfo=None), T) if value else T('N/A')


:)

The interresting part in red...

Richard

Reply all
Reply to author
Forward
0 new messages