title: Django reverse foreignkey query in template using _set
body: <p>Dear Stack community. </p>
  
  <p>given my simplified models: </p>
  
  <pre><code>* classes:
     name_id;
     description;
  * architectures: 
     name_id;
     description;
  * families:
     name_id;
     description;
     architecture = foreignKey(architectures);
     class = foreignKey(classes);
  </code></pre>
  
  <p>I'm trying to get from a query defined in views.py as:</p>
  
  <pre><code>query = classes.objects.all()
  return(query)
  </code></pre>
  
  <p>the number of architectures entry related to it in templates.</p>
  
  <pre><code>{% for obj in query %}
  Class {{ obj.name_id }} has {{ obj.families_set.all.architecture.count }} architectures.  
  {% endfor %}
  </code></pre>
  
  <p>But nothing is shown.</p>
  
  <p>If I try to do <code>{{ obj.families_set.all.count}}</code> I have all the number of families in the class. 
  If I try to do <code>{{ obj.families_set.all.o.architecture.name_id }}</code> I get the first name of architecture that belongs to the class. </p>
  
  <p>Can someone help? I don't understand what I'm doing wrong.</p>