1

別のテンプレートによるテンプレートのタグを使用すると、Invalid block tag: 'static'エラーが発生します。{% static .. %}{% include %}ed

後のテンプレートには{% load staticfiles %}.
含まれているテンプレートから再度ロードする必要がありますか?

4

1 に答える 1

4

Yes you do need to load it again. If you look at the docs for the include template tag you will notice:

The include tag should be considered as an implementation of “render this subtemplate and include the HTML”, not as “parse this subtemplate and include its contents as if it were part of the parent”. This means that there is no shared state between included templates – each include is a completely independent rendering process.

Note that the template you are loading uses the context of the parent template, so that's why you still have access to all the variables of the parent tepmlate

于 2013-10-10T06:20:45.077 に答える