Usage of timesince built in tag in Django Applications -
I want to use the inherent tag of the times to get the number of days since the event. The documentation for the tag is found here:
But when I apply it, it gives me data in a few weeks and takes some time in a few hours ... I only happen in days I'd like to ... I'm not sure how to change the filters to get the day ...
Some guidance is needed ... thanks ..
You can write very simple:
import datetime @ register.filter (name = 'days_since ') Def days_since (value): since = 0 try: since = (Datetime.datetime.now () - value) except for .days: since pass pass ... {{obj.date | Days_since}}
Comments
Post a Comment