diff options
author | Dan McGee <dan@archlinux.org> | 2010-09-15 01:47:12 +0200 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2010-09-15 01:47:12 +0200 |
commit | b084936ad9a1e5d7edfcfeb3495b997cb2fe368b (patch) | |
tree | 59b55c33255b29c9cada1f7b4921811d496304af | |
parent | 3394a94a4019406b643341771dae057d39af73e3 (diff) | |
download | archweb-b084936ad9a1e5d7edfcfeb3495b997cb2fe368b.tar.gz archweb-b084936ad9a1e5d7edfcfeb3495b997cb2fe368b.tar.xz |
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 <dan@archlinux.org>
-rw-r--r-- | settings.py | 3 | ||||
-rw-r--r-- | templates/news/list.html | 2 | ||||
-rw-r--r-- | templates/news/view.html | 2 | ||||
-rw-r--r-- | templates/packages/details.html | 2 | ||||
-rw-r--r-- | templates/packages/group_details.html | 2 | ||||
-rw-r--r-- | templates/packages/groups.html | 2 | ||||
-rw-r--r-- | templates/packages/search.html | 2 | ||||
-rw-r--r-- | templates/public/index.html | 2 |
8 files changed, 10 insertions, 7 deletions
diff --git a/settings.py b/settings.py index e1c9e85..3a7db39 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 258456a..14ba79b 100644 --- a/templates/news/list.html +++ b/templates/news/list.html @@ -28,7 +28,7 @@ <tbody> {% for item in news_list %} <tr class="{% cycle 'odd' 'even' %}"> - <td>{{ item.postdate }}</td> + <td>{{ item.postdate|date }}</td> <td class="wrap"><a href="{{ item.get_absolute_url }}" title="View: {{ item.title }}">{{ item.title }}</a></td> <td>{{ item.author.get_full_name }}</td> diff --git a/templates/news/view.html b/templates/news/view.html index a7c25a4..1c92fe7 100644 --- a/templates/news/view.html +++ b/templates/news/view.html @@ -16,7 +16,7 @@ </ul> {% endif %} - <p class="article-info">{{ news.postdate }} - {{ news.author.get_full_name }}</p> + <p class="article-info">{{ news.postdate|date }} - {{ news.author.get_full_name }}</p> <div class="article-content">{{ news.content|markdown }}</div> diff --git a/templates/packages/details.html b/templates/packages/details.html index 0bc9f40..f84b85e 100644 --- a/templates/packages/details.html +++ b/templates/packages/details.html @@ -144,7 +144,7 @@ <td>{{ pkg.build_date }} UTC</td> </tr><tr> <th>Last Updated:</th> - <td>{{ pkg.last_update|date:"Y-m-d" }}</td> + <td>{{ pkg.last_update|date }}</td> </tr> </table> diff --git a/templates/packages/group_details.html b/templates/packages/group_details.html index f15efaa..df9c5e9 100644 --- a/templates/packages/group_details.html +++ b/templates/packages/group_details.html @@ -29,7 +29,7 @@ <td>{{ pkg.pkgver }}-{{ pkg.pkgrel }}</td> {% endif %} <td class="wrap">{{ pkg.pkgdesc }}</td> - <td>{{ pkg.last_update|date:"Y-m-d" }}</td> + <td>{{ pkg.last_update|date }}</td> </tr> {% endfor %} </tbody> diff --git a/templates/packages/groups.html b/templates/packages/groups.html index a472e7b..8a96b7e 100644 --- a/templates/packages/groups.html +++ b/templates/packages/groups.html @@ -21,7 +21,7 @@ <td><a href="/groups/{{ grp.arch }}/{{ grp.name }}/" title="Group details for {{ grp.name }}">{{ grp.name }}</a></td> <td>{{ grp.count }}</td> - <td>{{ grp.last_update|date:"Y-m-d" }}</td> + <td>{{ grp.last_update|date }}</td> </tr> {% endfor %} </tbody> diff --git a/templates/packages/search.html b/templates/packages/search.html index e11e909..2aa82af 100644 --- a/templates/packages/search.html +++ b/templates/packages/search.html @@ -102,7 +102,7 @@ <td>{{ pkg.pkgver }}-{{ pkg.pkgrel }}</td> {% endif %} <td class="wrap">{{ pkg.pkgdesc }}</td> - <td>{{ pkg.last_update|date:"Y-m-d" }}</td> + <td>{{ pkg.last_update|date }}</td> </tr> {% endfor %} </tbody> diff --git a/templates/public/index.html b/templates/public/index.html index 72f0b12..5a87787 100644 --- a/templates/public/index.html +++ b/templates/public/index.html @@ -46,7 +46,7 @@ {% for news in news_updates %} <h4><a href="{{ news.get_absolute_url }}" title="View full article: {{ news.title }}">{{ news.title }}</a></h4> - <p class="timestamp">{{ news.postdate }}</p> + <p class="timestamp">{{ news.postdate|date }}</p> <div class="article-content">{{ news.content|markdown|truncatewords_html:75 }}</div> {% endfor %} |