2👍
✅
You could write a very simple template filter:
import datetime
@register.filter(name='days_since')
def days_since(value):
since = 0
try:
since = (datetime.datetime.now() - value).days
except:
pass
return since
...
{{ obj.date|days_since }}
Source:stackexchange.com