Javascript variables in Django HTML templates

后端 未结 3 1983
甜味超标
甜味超标 2021-01-19 03:41

I\'m writing a Django app and while somewhat familiar with Django I\'m pretty unfamiliar with JavaScript. I\'m adding a few lines of JavaScript into one of my pages in orde

3条回答
  •  -上瘾入骨i
    2021-01-19 04:00

    In my Django projects, if I am using a "base" template that every other template extends, I just put a block called "extrahead" inside of the in the HTML.

    
        
            ........ other header stuff
            ........ include other scripts
            {% block extrahead %}
            {% endblock %}
        
        .............
    
    

    ... and then use that block just in the template you want the map on. That is assuming that it is just static js code?

提交回复
热议问题