Pylons Quickie: I want to use distance_of_time_in_words

May 17, 2009 § Leave a comment

distance_of_time_in_words is a useful function that converts boring looking datetime into something more attractive (and SEO optimized) like: 30 seconds ago.

Pylons gain this functionality via WebHelper which blatantly inspired by Rails.

But, out of the box, this functionality does not exists in my templates. To enable it, I need to add this line in helpers.py:

from webhelpers.date import distance_of_time_in_words

Resource:

WebHelpers Documentation

Advertisements

Tagged: , ,

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

What’s this?

You are currently reading Pylons Quickie: I want to use distance_of_time_in_words at RAPD.

meta

%d bloggers like this: