I've got a Python function in my Django project where I need to return some HTML code, including the static URL where my images reside.
In a template, I can do <img src="{% static 'img/my_img.png' %}">.
Any idea how I can get this in Python code as part of a return statement?
Obviously I could include the whole URL in my return statement (as per the below) but this would violate Django's DRY principle (and would be problematic in case my image URL would change).
if my.condition:
return "<img src='/img/my_img.png' />" + obj.name
Using Django 1.8.