30👍
As per Django’s latest documentation, this is done for the sake of maintainability and sanity
When you load a custom tag or filter library, the tags/filters are
only made available to the current template – not any parent or child
templates along the template-inheritance path.For example, if a template foo.html has {% load humanize %}, a child
template (e.g., one that has {% extends "foo.html" %}) will not have
access to the humanize template tags and filters. The child template
is responsible for its own {% load humanize %}.This is a feature for the sake of maintainability and sanity.
3👍
Because that’s the way template tags work. You need to load each library for every template file that uses them.
- [Django]-Google Static Maps URL length limit
- [Django]-Postgresql: FATAL: password authentication failed for user "douglas"
- [Django]-How do I use django rest framework to send a file in response?
0👍
It’s logical that you’ll need {% load staticfiles %}
wherever you want url expansion to occur. If you have that happening in both base.html
& index.html
, you’ll have to include it at both places (as you’ve already figured).
- [Django]-Self.instance in Django ModelForm
- [Django]-How can I check the size of a collection within a Django template?
- [Django]-What does this Django regular expression mean? `?P`