title: Enumerate related objects through a many-to-many
body: <p>I know that this question seem to have been answered several times, but none of the answers I found really gave me any pointer to the issue I am facing.</p>
  
  <p>I have 3 models into a django application:</p>
  
  <pre><code>class Person(models.Model):
    name = model.CharField(...)
  
  class Topic(models.Model):
    key = model.CharField(...)
  
  class Interest(models.Model):
    person = models.ForeignKey(Person, on_delete=models.CASCADE)
    topic = models.ForeignKey(Topic, on_delete=models.CASCADE)
    comment = models.CharField(...)
  
  Person.interests = models.ManyToManyField(Topic, through="Interest")
  </code></pre>
  
  <p>The <code>views.py</code> is declared as follow:</p>
  
  <pre><code>class IndexView(generic.ListView):
    template_name = 'index.html'
    context_object_name = 'people_list'
  
    def get_queryset(self):
      return Person.objects.all()
  </code></pre>
  
  <p>And the <code>index.html</code> looks as follow:</p>
  
  <pre><code>    {% for person in people_list %}
          &lt;tr&gt;
              &lt;td&gt;{{ person.name }}&lt;/td&gt;
              &lt;td&gt;
                  &lt;ul&gt;
                  {% for interest in person.interests.all %}
                      &lt;li&gt;{{ interest }}&lt;/li&gt;
                  {% empty %}
                      No interest found
                  {% endfor %}
                  &lt;/ul&gt;
              &lt;/td&gt;
          &lt;/tr&gt;
      {% endfor %}
  </code></pre>
  
  <p>Surprisingly, the view returns 'No interest found' for every person when the admin site clearly shows interests for all persons.</p>
  
  <p>It looks like the <code>Person.objects.all()</code> in the <code>views.py</code> did not load the related objects from database.</p>
  
  <p>When using the shell, I get the following results:</p>
  
  <pre><code>Python 3.7.2 (default, Feb 12 2019, 08:15:36)
  [Clang 10.0.0 (clang-1000.11.45.5)] on darwin
  Type "help", "copyright", "credits" or "license" for more information.
  (InteractiveConsole)
  &gt;&gt;&gt; from app.models import Person, Topic, Interest
  &gt;&gt;&gt; person = Person.objects.all()[0]
  &gt;&gt;&gt; person.interests
  &lt;django.db.models.fields.related.ManyToManyField&gt;
  &gt;&gt;&gt; person.interests.all()
  Traceback (most recent call last):
    File "&lt;console&gt;", line 1, in &lt;module&gt;
  AttributeError: 'ManyToManyField' object has no attribute 'all'
  </code></pre>