August 2016
Beginner to intermediate
717 pages
15h 24m
English
Not all people keep track of the date and when talking about creation or modification dates of cutting-edge information; for many of us, it is convenient to read the time difference. For example, the blog entry was posted three days ago, the news article was published today, and the user last logged in yesterday. In this recipe, we will create a template filter named days_since, which converts dates to humanized time differences.
Create the utils app and put it under INSTALLED_APPS in the settings, if you haven't done that yet. Then, create a templatetags Python package in this app (Python packages are directories with an empty __init__.py file). ...
Read now
Unlock full access