I'm new to Django.I've parsed an XML file and when it's printed, I see all the titles and links in the xml file printed in the terminal (about 15 entries).However, then I try to display them in my template, it only returns a single entry (title and link). What am I doing wrong? Am not sure why arr and print are yielding different results.
view.py
def madxmlparser(request): url = 'https://www.example.com/rss/current.xml' tree = ET.parse(urlopen(url)) root = tree.getroot() for entry in root.findall('{http://www.w3.org/2005/Atom}entry'): title = entry.find('{http://www.w3.org/2005/Atom}title').text link = entry.find('{http://www.w3.org/2005/Atom}link').attrib['href'] arr = [title, link] print(title, link) return render(request, 'madxmlparser.html', {'arr':arr})
template.py
{% for i in arr %}<div class="row"> {{ i }}</div>{% endfor %}