mirror of
https://github.com/haiwen/seahub.git
synced 2025-07-19 17:39:39 +00:00
Modify group message time format
This commit is contained in:
parent
1be271353e
commit
c824155ac7
@ -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))
|
||||
|
||||
|
@ -85,7 +85,7 @@
|
||||
</div>
|
||||
<div class="txt fright">
|
||||
<div class="msg-hd">
|
||||
<span class="time">{{ msg.timestamp|date:"Y-m-d H:i" }}</span>
|
||||
<span class="time">{{ msg.timestamp|translate_commit_time }}</span>
|
||||
<a href="{{ SITE_ROOT }}profile/{{ msg.from_email }}/">{{ msg.from_email|email2nickname }}</a>
|
||||
</div>
|
||||
<div class="msg-bd">
|
||||
|
@ -14,7 +14,7 @@
|
||||
</div>
|
||||
<div class="txt fright">
|
||||
<div class="msg-hd">
|
||||
<span class="time">{{ msg.timestamp|date:"Y-m-d H:i" }}</span>
|
||||
<span class="time">{{ msg.timestamp|translate_commit_time }}</span>
|
||||
<a href="{{ SITE_ROOT }}profile/{{ msg.from_email }}/">{{ msg.from_email|email2nickname }}</a>
|
||||
所在小组:<a href="{{ SITE_ROOT }}group/{{ msg.group_id }}/">{{ msg.group_name }}</a>
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user