Suppose my template has in it something like {% block subject %}my subject{% endblock %} and I load this template with tmpl = loader.get_template('mytemplate.html'), how can I extract “my subject”?
Suppose my template has in it something like {% block subject %}my subject{% endblock
Share
Camilo’s solution doesn’t work when your template extends a base. I’ve modified it a bit to (hopefully) fix that problem:
I’m really not sure if this is the right way to recursively iterate over all the nodes… but it works in my limited case.