django templates - using block.super in included template fails (exception)

前端 未结 2 823
深忆病人
深忆病人 2021-01-08 01:04

the idea is to to have multiple widgets on a page and include all js and css files needed form this \'widgets\' (it\'s easy to manage files this way). Duplicated files is no

相关标签:
2条回答
  • 2021-01-08 01:25

    I know it a bit too late but I may have some solution. Using django-sekizai you can load js and css into one place. Take a look at http://django-sekizai.readthedocs.org/en/latest/

    0 讨论(0)
  • 2021-01-08 01:39

    From the docs:

    Note

    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.

    If you want block.super to work then you need to use extends instead.

    0 讨论(0)
提交回复
热议问题