<script>
{{ somedjangovariable }}=2;
</script>
In a html page can we do something like this:
If you use
<script>
{{ somedjangovariable }}=2;
</script>
in a Django template, your tag will be filled by the python value of somedjangovariable
, computed server-side.
It can work, but it is quite a strange pattern to use a server-side value to name a javascript variable.