title: Django template tags forloop
body: <p>I have created a template tag and trying to loop through the results from the template tag
  but I don't get any results</p>
  
  <p>tags.py</p>
  
  <pre><code>from django import template
  from loadprograms import dbcontext
  
  register = template.Library()
  
  
      @register.simple_tag
      def get_category():
          x = dbcontext.DBContext()
          results = x.executequery("Select name from Categories")
          categories = [each[0] for each in results]
          return categories 
  </code></pre>
  
  <p>template code</p>
  
  <pre><code>{% load category_tags %}
  {% get_category %}
  {% for each in get_category %}
      {{ each }}
  {% endfor %}
  </code></pre>
  
  <p>The {% get_category %} prints all the categories without any issues but the for loop stmt
  that loop through the results does not work</p>
  
  <p>What could be the problem?</p>