- do the comparison in your view and add the result (true/false) to the context
- add the cutoff date to the context and compare the two datetime objects in your template
- write/find a templatetag or filter that can do what you need
On Friday, November 23, 2012 12:36:27 AM UTC-6, Dae_James wrote:
For example, art_time is a date-time type.As we know, {{ art_time|timesince }} return the time since art_time to now. However, I want to know how to judge whether the result is within 24 hours.Shortly, how to know whether art_time is today or the day before today in template layer?
You received this message because you are subscribed to the Google Groups "Django users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/EmGMHChbbLkJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
No comments:
Post a Comment