Tuesday, May 28, 2019

Display image in template

I want to display image dynamically from the database in a django template. I have used ImageField for this purpose. The code shows no error but it is only displaying an icon of image.
This is my template file,
here album is the context and album_logo is the variable in which i have stored my image. please tell me how can i fix this issue
<img src="{{ album.album_logo}}">

<h1>{{ album.album_title}}</h1>
<h3>{{ album.artist }}</h3>

<ul>
{% for song in album.song_set.all %}
<li>{{song.song_title}}-{{song.file_type}}</li>
{% endfor %}
</ul>

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAMT%3DisWxuO9d1tTMacyYauDAmQS%2B2e_B9HawfZP7eY8smCS%3D2Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment