mirror of
https://github.com/haiwen/seahub.git
synced 2025-07-21 18:32:37 +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):
|
def translate_commit_time(value):
|
||||||
"""Translate commit time to human frindly format instead of timestamp"""
|
"""Translate commit time to human frindly format instead of timestamp"""
|
||||||
limit = 14 * 24 * 60 * 60 # Timestamp with in two weeks will be translated
|
limit = 14 * 24 * 60 * 60 # Timestamp with in two weeks will be translated
|
||||||
|
if hasattr(value, 'strftime'):
|
||||||
|
val = datetime.fromtimestamp(int(value.strftime("%s")))
|
||||||
|
else:
|
||||||
val = datetime.fromtimestamp(value)
|
val = datetime.fromtimestamp(value)
|
||||||
|
|
||||||
now = datetime.now()
|
now = datetime.now()
|
||||||
delta = now - (val - dt.timedelta(0, 0, val.microsecond))
|
delta = now - (val - dt.timedelta(0, 0, val.microsecond))
|
||||||
|
|
||||||
|
@ -85,7 +85,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="txt fright">
|
<div class="txt fright">
|
||||||
<div class="msg-hd">
|
<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 }}profile/{{ msg.from_email }}/">{{ msg.from_email|email2nickname }}</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="msg-bd">
|
<div class="msg-bd">
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="txt fright">
|
<div class="txt fright">
|
||||||
<div class="msg-hd">
|
<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 }}profile/{{ msg.from_email }}/">{{ msg.from_email|email2nickname }}</a>
|
||||||
所在小组:<a href="{{ SITE_ROOT }}group/{{ msg.group_id }}/">{{ msg.group_name }}</a>
|
所在小组:<a href="{{ SITE_ROOT }}group/{{ msg.group_id }}/">{{ msg.group_name }}</a>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user