How to add an image through {{i.image}} to template in django?
In this template i want to put something like {{i.image}} instead of "{% static '3307209.jpg'%}"
{% load static %}
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="{% static 'main.css' %}">
</head>
<body>
{% for i in pr%}
<div class='card'>
<div class="number">{{i.number}}</div>
<img src="{% static '3307209.jpg'%}">
<span class="prname">{{i.name}}</span>
<p id="id">{{i.description}}</p>
<button><span class="price"> ${{i.price}}</span> <img id='add'src="{% static 'add.png'%}"> Add to cart</button>
</div>
{%endfor%}
</body>
</html>
So i have an image field in my models and my views are ready.
to change an image inside my template from admin page i tried this but did not work:
<img src={{i.image}}>
How can i add an image to template from database?
use this in template:
<img src="{{ i.image.url}}">