From 0da793abe28bb26a279a12e8db1762e885cf4c50 Mon Sep 17 00:00:00 2001 From: jordan Date: Mon, 11 Apr 2011 18:43:15 +0000 Subject: [PATCH] OSQA-160, now instead of using the Python date library strftime function we use the Django dateformat.format utility which provides better support for localized dates. The pretext word 'at' that has been replaced with a single comma. git-svn-id: http://svn.osqa.net/svnroot/osqa/trunk@971 0cfe37f9-358a-4d5e-be75-b63607b5c754 --- forum/templatetags/extra_tags.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/forum/templatetags/extra_tags.py b/forum/templatetags/extra_tags.py index 04b260f..b9e95eb 100644 --- a/forum/templatetags/extra_tags.py +++ b/forum/templatetags/extra_tags.py @@ -9,6 +9,7 @@ import random from django import template from django.utils.encoding import smart_unicode from django.utils.safestring import mark_safe +from django.utils import dateformat from forum.models import Question, Answer, QuestionRevision, AnswerRevision, NodeRevision from django.utils.translation import ugettext as _ from django.utils.translation import ungettext @@ -141,9 +142,10 @@ def diff_date(date, limen=2): if days > 2: if date.year == now.year: - return date.strftime(_("%b %d at %H:%M").encode()) + return dateformat.format(date, 'd M, H:i') else: - return date.strftime(_("%b %d '%y at %H:%M").encode()) + return dateformat.format(date, 'd M \'y, H:i') + elif days == 2: return _('2 days ago') elif days == 1: -- 2.45.1