During my time working on Brewmance, I've been using a flavor of Django on Google AppEngine. In general, it's been a rocky but not impossible experience. However, I often miss the conveniences provided to front-end developers by the Rails platform I use during my nine-to-five.
Tonight in particular I was looking for a worthy match for the Rails date helper "timeago" which converts the difference between two dates (one usually being the current time) and prints them in a very human readable format. Django has a built-in filter set called "humanize" that does something similar. It can take a date and print either "yesterday", "today", "tomorrow", or "February 26, 2010". There's another built-in tag called "timesince" that can take a date and print "1 day, 8 hours". The depth of user experience either provides is as thin as the ice in Vancouver right now.
Web users expect to see natural language in their applications thanks to Facebook and many others. (If you've ever used the old Facebook news story template API, you'd know how much work they put into translating data into perfect pronoun and plurality agreement).
Anyway, the point of this diatribe is that I decided to do a rough port of the Rails "timeago" to a Django template filter.
Check it out on github!
February 28, 2010
Barely humanize
Subscribe to:
Post Comments (Atom)

0 comments:
Post a Comment