[Fixed]-Creating my first Custom Template in django

1👍

It’d be nice if you can properly format your code (I can’t edit your post for some reason). Judging by your post though, the issue is that you are not loading the tag. You should put the current_time function in a folder called “templatetags” (this folder should be at the same level as your views.py and models.py file). Add the

__init__.py 

file to ensure the directory is treated as a Python package.

Next, in the templatetags folder, place current_time function in a file called current_time.py. Then in your template, add this line to the top of the template:

{% load current_time %}

Look at the documentation here for more information: https://docs.djangoproject.com/en/1.8/howto/custom-template-tags/

Leave a comment