Django Template Variables and Javascript

后端 未结 15 2380
误落风尘
误落风尘 2020-11-22 05:59

When I render a page using the Django template renderer, I can pass in a dictionary variable containing various values to manipulate them in the page using {{ myVar }}

15条回答
  •  别那么骄傲
    2020-11-22 06:28

    I was facing simillar issue and answer suggested by S.Lott worked for me.

    
    

    However I would like to point out major implementation limitation here. If you are planning to put your javascript code in different file and include that file in your template. This won't work.

    This works only when you main template and javascript code is in same file. Probably django team can address this limitation.

提交回复
热议问题