Getting the template name in django template

后端 未结 3 1887
遥遥无期
遥遥无期 2020-12-31 23:03

For debugging purposes, I would like to have a variable in all my templates holding the path of the template being rendered. For example, if a view renders templates/accoun

3条回答
  •  长情又很酷
    2020-12-31 23:31

    Templates are just strings not file names. Probably your best option is to monkey patch render_to_response and/or direct_to_template and copy the filename arg into the context.

提交回复
热议问题