Answer the question
In order to leave comments, you need to log in
How to display images on the site in django from the model?
There is a model in django that accepts text and an image (via imageField, respectively). There are already several objects in the database according to this model, all objects need to be displayed on the site with the image of the object itself. Display the text of the object like two fingers, but problems begin with the image. The path where django loads the image from the user is given below:
product_img = models.ImageField('Обложка товара', upload_to='catalog/imgproduct/img')
<img class="product_img" src="{{a.product_img.url}}">
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question