Django - how to get the contents of a {% block %} tag from a template

后端 未结 2 1501
别那么骄傲
别那么骄傲 2021-01-19 05:43

I got this far:

>>> some_template = get_template_from_string(
...     load_template_source(
...         \'some_template.html\',
...         settings         


        
2条回答
  •  死守一世寂寞
    2021-01-19 06:21

    This seems like you're working hard against the Django grain. Put the content into an include file, then {% include %} it in your block, and also read the file directly. If you could tell us more about what you're trying to accomplish, there's probably a better way to do it.

提交回复
热议问题