Is it possible to load a custom template tag in base and use it in extented templates

Viewed 1213

I loaded a custom template tag note_extras.py in base.html.

base.html

<div id="wrap">
{% load note_extras %}    
{% block content %}
{% endblock %}
</div><!--wrap-->

but it is not accessible at templates which is an extend of base.html ie::

home.html

{% extends "base.html" %}
{% block content %}
<div class="container">
{% create_tagmenu request.user.pk %}
</div>
{% endblock %}

it is working fine if i load note_extras in home.html ie:

{% extends "base.html" %}
{% load note_extras %}
....
3 Answers

In case anyone was wondering, add_to_builtins has been deprecated but one could still load a tag for all of the templates in the project via settings.TEMPLATES - supported for Django 1.9 onwards as described here: https://stackoverflow.com/a/59719364/2447803

Related