I am looking for a way different possible image source in my html code, depending on result of a python function.
Exemple if:
state = isOnline()
is a function that can say if a device is online or not, it returns:
True
then I would obtain
IMG_URL = imgSource(state)
would return the source for online image
static 'project\img\true.jpg'
which I would then through my views.py used as:
def device(request):
return render(request, 'device.html', {'IMG_URL': IMG_URL})
and then I could use this variable in my html code.
<img src="{% IMG_URL %}" alt="Post">
I hope you guys will be capable to help me, thanks !