I want to put a link inside a variable (in View Django)
But I get a error.
In the slug section (slug =% slug), Python confuses % url with %u!
Error: %u format: a number is required, not str
I use the Folium library and want to put a link in the popup. So, I can not use the normal mode and I have to use another method.
for i in range(10):
slug=i
url = Template(
"""
<!DOCTYPE html>
<html>
<body>
<a href="{% url 'test' slug= %slug %}" target="_blank" style=" text-align:
right; ">Mor Info</a>
</body>
</html>
"""%slug).render(Context({}))
popup = folium.features.GeoJsonPopup(
fields=["name"],
aliases=[f'{url}'],
labels=True,
localize=True,
style="background-color: yellow;")