diff --git a/base/templatetags/seahub_tags.py b/base/templatetags/seahub_tags.py index 1973adc51e..2a41e2d216 100644 --- a/base/templatetags/seahub_tags.py +++ b/base/templatetags/seahub_tags.py @@ -46,7 +46,11 @@ def translate_commit_desc(value): def translate_commit_time(value): """Translate commit time to human frindly format instead of timestamp""" limit = 14 * 24 * 60 * 60 # Timestamp with in two weeks will be translated - val = datetime.fromtimestamp(value) + if hasattr(value, 'strftime'): + val = datetime.fromtimestamp(int(value.strftime("%s"))) + else: + val = datetime.fromtimestamp(value) + now = datetime.now() delta = now - (val - dt.timedelta(0, 0, val.microsecond)) diff --git a/group/templates/group/group_info.html b/group/templates/group/group_info.html index b8c03b8f0a..8306914938 100644 --- a/group/templates/group/group_info.html +++ b/group/templates/group/group_info.html @@ -85,7 +85,7 @@
- {{ msg.timestamp|date:"Y-m-d H:i" }} + {{ msg.timestamp|translate_commit_time }} {{ msg.from_email|email2nickname }}
diff --git a/group/templates/group/new_msg_reply.html b/group/templates/group/new_msg_reply.html index afbecbba40..bca2bbac15 100644 --- a/group/templates/group/new_msg_reply.html +++ b/group/templates/group/new_msg_reply.html @@ -14,7 +14,7 @@
- {{ msg.timestamp|date:"Y-m-d H:i" }} + {{ msg.timestamp|translate_commit_time }} {{ msg.from_email|email2nickname }} 所在小组:{{ msg.group_name }}