so am using templates in my project,
and am trying to put all the resources such as js at the end of the parent template (base.html) to render the page before requesting the files,
but that causes more load in other children pages since it's requesting the same resources everytime even if it doesn't use it.
what can I do here to handle the resources properly?
#Django templates
5 messages · Page 1 of 1 (latest)
Only include them in the templates that need them?
well yeah thats the only soloution for now, but i want the resources to be at the end of the page so that it renders before requesting the resources, and am not sure if i could do that
Yep, using blocks! Presumably you're using them already to override parts of the base template?
Add a {% block js %}{% endblock %} in the base template where you'd like these scripts to be injected by the child templates, and then put the script includes in that block in the child templates