Reputation: 477
In a loop I iterate over several URLs stored in movie.poster. If I only print movie.poster it returns the URL.
<ul>
{% for movie in all_movies %}
<li> {{ <img src="movie.poster" alt="Cheetah!" /> }} </li>
<!--<input type = "submit" value = "delete"/>-->
<!-- <img src="movie.poster" alt="Cheetah!" />-->
{% endfor %}
</ul>
When I run the code below I get the following error message "Could not parse the remainder: […]" How could I fix this?
Upvotes: 1
Views: 1458
Reputation: 834
use {{ }}
for variables not for a line, and .url
to call an image
so:
<li><img src="{{movie.poster.url}}" alt="Cheetah!"></li>
will call the image
Upvotes: 2