Hello, I'm new to django. I have faced with this problem and couldn't find an answer to my problem. I zip 2 lists and I want to iterate them simultaneously.
I get this error
Reverse for '{{newspaper}}' not found. '{{newspaper}}' is not a valid view function or pattern name.
my html file
{% extends "index-template.html" %}
{% block content %}
{% load staticfiles %}
{% for newspaper, newspaper_name in mylist %}
<li class="col-xs-12 col-sm-6 col-md-4 col-lg-4">
<div class="box nop">
<div class="bar"> <img src="{% static "/icons/{{newspaper}}.png" %}".......
{% endfor %}
{% endblock %}
my index fuction in views.py
def index(request):
newspapers = ["BBC", "Guardian"]
newspaper_names = ["BBC News", "The Guardian"]
mylist = zip(newspapers, newspaper_names)
return render(request, "index.html", {"currentdate": getcurrentdate(), "mylist": mylist})