I made a map application using Mapbox, where a user can click on a feature and a popup shows with details about the feature. I would also like to provide a link in the popup to the DetailView of the object using Javascript, but I'm having trouble generating the anchor tag. So far I have
new mapboxgl.Popup()
.setLngLat(e.lngLat)
.setHTML('<a href="{% url app_name:view pk=foo %}">To Detail View</a>')
.addTo(map);
But when I try it out on the development server, it gives me a 404 error with a request url of http://127.0.0.1:8000/map/%7B%25%20url%20app_name:view%20pk%3Dfoo%20%25%7D
How do I get it to pass the correct url? I've also tried inserting the link into a normal HTML div and I get the same problem.