How to display in models img to html in django

I tried to display to html changeable profile image with admin. can someone explain please

models in Portfolio app :

class ProfileImage(models.Model):
  profile = models.ImageField(("Profile image"), upload_to=None, height_field=None, width_field=None, max_length=None)

this is base html in template folder (i tried this one) :

<img src="{{ portfolio.models.ProfileImage.progile.url }}" alt="profile"><br />

You should first configure your model to store profile pictures. Your ProfileImage model looks correct, but you need to specify where the images should be uploaded using the upload_to argument of ImageField.

Include the model in your admin form by using a ModelForm or manually adding it to the admin's fields list.

In your HTML template, you can display the image using the url attribute of your template's ImageField object.

You have an error in your HTML above, it should be profile.url and not portfolio.models.ProfileImage.profile.url:

<img src="{{ profile.image.url }}" alt="profile">
Back to Top