Skip to content

Commit 7f38513

Browse files
committed
Date formatting to solve issue #16
1 parent 47e7533 commit 7f38513

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

server/templates/server/machine_detail.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ <h3>Managed Software Update</h3>
115115
{% if machine.last_puppet_run %}
116116
<tr>
117117
<th>Puppet Run:</th>
118-
<td>{{ machine.last_puppet_run }}</td>
118+
<td>{{ machine.last_puppet_run|format_date }}</td>
119119
</tr>
120120
{% endif %}
121121
</tbody>

server/templates/server/overview_list_all.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{% extends "base.html" %}
22
{% load i18n %}
3-
3+
{% load dashboard_extras %}
44
{% block script %}
55
<script type="text/javascript" charset="utf-8">
66
$(document).ready(function() {
@@ -45,7 +45,7 @@
4545
</td>
4646

4747
<td>{{ item.console_user }}</td>
48-
<td>{{ item.last_checkin }}</td>
48+
<td>{{ item.last_checkin|format_date }}</td>
4949
</tr>
5050
{% endfor %}
5151
</tbody>

server/templatetags/dashboard_extras.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,5 +38,9 @@ def bu_machine_count(bu_id):
3838
def convert_datetime(string):
3939
"""Converts a string into a formatted date"""
4040
the_date = datetime.strptime(string, "%Y-%m-%d %H:%M:%S +0000")
41-
return date(the_date, "N j, Y, P")
42-
41+
return date(the_date, "Y-m-d H:i")
42+
43+
@register.filter
44+
def format_date(string):
45+
"""Converts a date object into something that can be sorted separately"""
46+
return date (string, "Y-m-d H:i")

0 commit comments

Comments
 (0)