title: context and dictionaries python Django
body: <p>So I have the following code:</p>
  
  <p>views.py:</p>
  
  <pre><code>def topics(request):
      """Show all topics"""
      topics = Topic.objects.order_by('date_added')
      context = {'topics': topics}
      return render(request, 'learning_logs/topics.html', context)
          return render(request, 'learning_logs/topic.html', context)
  </code></pre>
  
  <p>I  understand that I am querying the database and sorting the data by date then storing that data in the topics variable. My first question is, is the topics variable storing the data as a list? (assuming multiple entries).</p>
  
  <p>If so when I have the following code in my html file</p>
  
  <p>topics.html:</p>
  
  <pre><code>&lt;ul&gt;
    {% for topic in topics %}
      &lt;li&gt;{{ topic }}&lt;/li&gt;
    {% empty %}
      &lt;li&gt;No topics have been added yet.&lt;/li&gt;
    {% endfor %}
  &lt;/ul&gt;
  </code></pre>
  
  <p>why do I need pass the data stored in topics into a context dictionary for topics.html to loop through and display the data? why not loop through the topics variable itself? I'm just confused on the use of "contexts"</p>
  
  <p>Thanks for the help in advance.</p>