Commit 657ba3f6 authored by Dan Pascu's avatar Dan Pascu

Improved displaying call history entries

parent 1a416249
...@@ -119,14 +119,16 @@ class HistoryEntry(object): ...@@ -119,14 +119,16 @@ class HistoryEntry(object):
def __unicode__(self): def __unicode__(self):
result = unicode(self.remote_identity) result = unicode(self.remote_identity)
if self.call_time: if self.call_time:
days = (date.today() - self.call_time.date()).days call_date = self.call_time.date()
if days == 0: today = date.today()
days = (today - call_date).days
if call_date == today:
result += self.call_time.strftime(" at %H:%M") result += self.call_time.strftime(" at %H:%M")
elif days == 1: elif days == 1:
result += self.call_time.strftime(" Yesterday at %H:%M") result += self.call_time.strftime(" Yesterday at %H:%M")
elif days < 7: elif days < 7:
result += self.call_time.strftime(" on %A") result += self.call_time.strftime(" on %A")
elif days < 365: elif call_date.year == today.year:
result += self.call_time.strftime(" on %B %d") result += self.call_time.strftime(" on %B %d")
else: else:
result += self.call_time.strftime(" on %Y-%m-%d") result += self.call_time.strftime(" on %Y-%m-%d")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment