title: TypeError: 'function' object is not iterable flask
body: <p>I'm testing a new app in Flask but I don't know what went wrong.</p>
  
  <p>I created <strong>toy.py</strong> and added a class to it.</p>
  
  <pre><code>class Toy:
      count = 1
  
      def __init__(self, name):
          self.name = name
          self.id = Toy.count
          Toy.count += 1
  </code></pre>
  
  <p>In the <strong>app.py</strong></p>
  
  <pre><code>from flask import Flask, render_template, url_for, request, redirect
  from toy import Toy
  
  
  app = Flask(__name__)
  
  
  spiderman = Toy(name='spiderman')
  superman = Toy(name='superman')
  bathman = Toy(name='bathman')
  
  toys = [spiderman, superman, bathman]
  
  @app.route('/toys',)
  def toys():
      return render_template('toys.html', toys=toys)
  
  
  if __name__ == '__main__':
      app.run(debug=True)
  </code></pre>
  
  <p>In the HTML file I was trying to loop true</p>
  
  <pre><code>{% extends 'base.html' %}
  
  {% block title %}
  TOYS PAGE
  {% endblock %}
  
  {% block body %}
  &lt;ul&gt;
      {% for toy in toys %}
      &lt;li&gt;{{ toy.name }}&lt;/li&gt;
      {% endfor %}
  &lt;/ul&gt;
  
  {% endblock %}
  </code></pre>
  
  <p>I am receiving the following error:</p>
  
  <pre><code>**{% for toy in toys %}
  TypeError: 'function' object is not iterable**
  </code></pre>