Iam trying to parse html page and find all image tags and display it in django template
view
import urllib2
from BeautifulSoup import BeautifulSoup
page = urllib2.urlopen("http://www.flipkart.com/")
soup = BeautifulSoup(page)
tags=soup.findAll('img')
template = get_template('welcome.html')
variables = RequestContext(request,{'tags':tags})
output = template.render(variables)
return HttpResponse(output)
Template
{% block content %}
<div class="row">
<ul class="thumbnails">
{% for row in tags %}
<li >
<span>Flash</span>
<a href="#" class="thumbnail">
{{ row }}
</a>
</li>
{% endfor %}
</ul>
</div>
{% endblock %}
i printed tags
[<img src="http://passets-cdn.pinterest.com/images/search.gif" alt="" />, <img src="http://media-cache2.pinterest.com/upload/422281184577033_NvxwzARh_b.jpg" alt="#wedding #bouquet #flowers" class="PinImageImg" style="height: 288px;" />, <img src="http://media-cache0.pinterest.com/avatars/heygirlfriend-33.jpg" alt="Profile picture of Heather Carpenter" />, <img src="http://media-cache2.pinterest.com/avatars/lilizzy08_1330284092.jpg" class="profile user_image" alt="Profile picture of JoAnn Boyle Barker" />, <img src="http://media-cache2.pinterest.com/avatars/camelotparty_1330114747.jpg" class="profile user_image" alt="Profile picture of Camelot Party" />, <img src="http://media-cache5.pinterest.com/avatars/mamababe13_1327965590.jpg" class="profile user_image" alt="Profile picture of Irene Hardin Sanchez" />, <img src="http://media-cache5.pinterest.com/avatars/mpowers213_1333304368.jpg" class="profile user_image" alt="Profile picture of Maggie Powers" />, <img src="http://media-cache7.pinterest.com/avatars/apricot1026_1334529181.jpg" class="profile user_image" alt="Profile picture of Michelle Nadel" />, <img src="http://media-cache4.pinterest.com/upload/169025792234929326_WtMMM67J_b.jpg" alt="Dr. Oz Metabolism Booster" class="PinImageImg" style="height: 256px;" />, <img src="http://media-cache6.pinterest.com/avatars/karenmigala_1332630951.jpg" alt="Profile picture of Karen Migala" />, <img src="http://media-cache9.pinterest.com/avatars/dutchjohnson-26.jpg" class="profile user_image" alt="Profile picture of Dutch Johnson" />]
when i tried to print the tags there is lot of img tags, But iam getting an empty list in browser(when displayed).
HTML page Displays
multple empty lists like [] [] [] [] [] []
Rendered Content
<li >
<span>Flash</span>
<a href="#" class="thumbnail">
[]
</a>
</li>
<li >
<span>Flash</span>
<a href="#" class="thumbnail">
[]
</a>
</li>
<li >
<span>Flash</span>
<a href="#" class="thumbnail">
[]
</a>
</li>
<li >
<span>Flash</span>
<a href="#" class="thumbnail">
[]
</a>
</li>
<li >
<span>Flash</span>
<a href="#" class="thumbnail">
[]
</a>
</li>
Please help
output