Assign JavaScript value to Django template tag argument -


how assign argument value django template tag, using javascript?

{% url path.to.some_view arg=v %} 

this doesn't work:

<script>     var v = 5; </script> {% url path.to.some_view arg=v %} 

this should work:

<script>     var v = 5;     var url = '{% url path.to.some_view 999 %}'.replace (999, v); </script> 

Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -