Get javascript variable’s value in Django url template tag

I found a trick that might work under most circumstances:

var url_mask = "{% url 'someview' arg1=12345 %}".replace(/12345/, tmp.toString());

It’s clean, and it doesn’t break DRY principle.

Leave a Comment