From b084936ad9a1e5d7edfcfeb3495b997cb2fe368b Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Tue, 14 Sep 2010 18:47:12 -0500 Subject: Ensure consistent date formatting everywhere Set up a default DATE_FORMAT in settings.py and use it everywhere we do the '|date' template filter rather than hardcoding the value in the template. This also fixes a regression with news date/time now that we changed the field to store both date and time. Signed-off-by: Dan McGee --- settings.py | 3 +++ templates/news/list.html | 2 +- templates/news/view.html | 2 +- templates/packages/details.html | 2 +- templates/packages/group_details.html | 2 +- templates/packages/groups.html | 2 +- templates/packages/search.html | 2 +- templates/public/index.html | 2 +- 8 files changed, 10 insertions(+), 7 deletions(-) diff --git a/settings.py b/settings.py index e1c9e853..3a7db393 100644 --- a/settings.py +++ b/settings.py @@ -33,6 +33,9 @@ USE_I18N = False # calendars according to the current locale USE_L10N = False +# Default date format in templates for 'date' filter +DATE_FORMAT = 'Y-m-d' + # URL prefix for admin media -- CSS, JavaScript and images. Make sure to use a # trailing slash. # Examples: "http://foo.com/media/", "/media/". diff --git a/templates/news/list.html b/templates/news/list.html index 258456a5..14ba79b6 100644 --- a/templates/news/list.html +++ b/templates/news/list.html @@ -28,7 +28,7 @@ {% for item in news_list %} - {{ item.postdate }} + {{ item.postdate|date }} {{ item.title }} {{ item.author.get_full_name }} diff --git a/templates/news/view.html b/templates/news/view.html index a7c25a43..1c92fe78 100644 --- a/templates/news/view.html +++ b/templates/news/view.html @@ -16,7 +16,7 @@ {% endif %} - +
{{ news.content|markdown }}
diff --git a/templates/packages/details.html b/templates/packages/details.html index 0bc9f40f..f84b85ef 100644 --- a/templates/packages/details.html +++ b/templates/packages/details.html @@ -144,7 +144,7 @@ {{ pkg.build_date }} UTC Last Updated: - {{ pkg.last_update|date:"Y-m-d" }} + {{ pkg.last_update|date }} diff --git a/templates/packages/group_details.html b/templates/packages/group_details.html index f15efaac..df9c5e96 100644 --- a/templates/packages/group_details.html +++ b/templates/packages/group_details.html @@ -29,7 +29,7 @@ {{ pkg.pkgver }}-{{ pkg.pkgrel }} {% endif %} {{ pkg.pkgdesc }} - {{ pkg.last_update|date:"Y-m-d" }} + {{ pkg.last_update|date }} {% endfor %} diff --git a/templates/packages/groups.html b/templates/packages/groups.html index a472e7b2..8a96b7e3 100644 --- a/templates/packages/groups.html +++ b/templates/packages/groups.html @@ -21,7 +21,7 @@ {{ grp.name }} {{ grp.count }} - {{ grp.last_update|date:"Y-m-d" }} + {{ grp.last_update|date }} {% endfor %} diff --git a/templates/packages/search.html b/templates/packages/search.html index e11e9094..2aa82af1 100644 --- a/templates/packages/search.html +++ b/templates/packages/search.html @@ -102,7 +102,7 @@ {{ pkg.pkgver }}-{{ pkg.pkgrel }} {% endif %} {{ pkg.pkgdesc }} - {{ pkg.last_update|date:"Y-m-d" }} + {{ pkg.last_update|date }} {% endfor %} diff --git a/templates/public/index.html b/templates/public/index.html index 72f0b12b..5a87787d 100644 --- a/templates/public/index.html +++ b/templates/public/index.html @@ -46,7 +46,7 @@ {% for news in news_updates %}

{{ news.title }}

-

{{ news.postdate }}

+

{{ news.postdate|date }}

{{ news.content|markdown|truncatewords_html:75 }}
{% endfor %} -- cgit v1.2.2