Assign variables to child template in {% include %} tag Django

后端 未结 1 1508
面向向阳花
面向向阳花 2020-12-07 21:47

I have this code(which doesn\'t give me expected result)

#subject_content.html
{% block main-menu %}
    {% include \"subject_base.html\" %}
{% endblock %}

         


        
相关标签:
1条回答
  • 2020-12-07 22:34

    Like @Besnik suggested, it's pretty simple:

    {% include "subject_file_upload.html" with form=form foo=bar %}
    

    The documentation for include mentions this. It also mentions that you can use only to render the template with the given variables only, without inheriting any other variables.

    Thank you @Besnik

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