[Django]-Django extra javascript is not working in the child page

8👍

You need to define an empty {% block extra_js %} in the base.html, then Django is placing the content of the block extra_js of thechild.html and place it in the block of the parent.

base.html should look something like this:

<html>
<head></head>
<body>
...
<div id="content">
{% block content %}{% endblock content %}
</div>

{% block extra_js %}{% endblock extra_js %}
</body>
</html>

Leave a comment