Update by natay on Wed May 29 17:25:03 EDT 2019 from Admins-MacBook-Air.local
@@ -80,26 +80,3 @@ def show_email(target, user=None):
return email
-@register.filter
-def time_ago(date):
- if not date:
- return ''
- delta = now() - date
- if delta < timedelta(minutes=1):
- return 'just now'
- elif delta < timedelta(hours=1):
- unit = pluralize(delta.seconds // 60, "minute")
- elif delta < timedelta(days=1):
- unit = pluralize(delta.seconds // 3600, "hour")
- elif delta < timedelta(days=30):
- unit = pluralize(delta.days, "day")
- elif delta < timedelta(days=90):
- unit = pluralize(int(delta.days / 7), "week")
- elif delta < timedelta(days=730):
- unit = pluralize(int(delta.days / 30), "month")
- else:
- diff = delta.days / 365.0
- unit = '%0.1f years' % diff
- return "%s ago" % unit
-
-
