If a question posted i开发者_运维问答s over 24 hours old then I want to limit it to show the day count and not the hours count. Obviously if under 24 hours old then show the hours count.
Currently: Asked 1 day, 18 hours ago
Optimal: Asked 1 day ago
{{question.created|timesince}}
Still fairly new to Django, any help would be appreciated.
Have a look at naturaltime: https://docs.djangoproject.com/en/dev/ref/contrib/humanize/#naturaltime
It should give you what you're looking for.
精彩评论