In the avatar field of my user, the name of the avatar is stored together with the extension, this is:
avatar="image.png"
In my html I want to make it load the image from the static folder:
src="{% static 'img/avatars/{{request.user.avatar}}' %}">
Inside the static/img/avatar/ folder is the image.
My problem is that the variable {{request.user.avatar}} is not replaced by the value, but is written as is:
Could not parse the remainder: '{{request.user.avatar}}' from ''img/avatars/'{{request.user.avatar}}'
How can I do what I'm looking for?
I just found the solution here .
I have changed it to: