I would like to know how to properly attach a media files (css / js) for different subpages.
I have a dilemma between:
Using {% block %}<script type="text/javascript" src="{% static 'js/script.js' %}"></script>{% endblock %}
in template files. Or register function like attach_media(type, url)
and use it in views.py.
There is still a class "Media" for forms, where I can:
associate different files – like stylesheets and scripts – with the forms and widgets that require those assets
But at the moment I'm not sure in every view I'll use the form.
Which solution is best?