[Answer]-Django multi level querying

1👍

The question is still confusing, because there is still no querying of topics or subjects going on. You are simply iterating through a user’s topics, and for each topic you are iterating through the subjects.

<ul>
  {% for topic in user.topic_set.all %}
    <li>{{ topic.title }}
      <ul>
        {% for subject in topic.subject_set.all %}
          <li>{{ subject.title }}</li>
        {% endfor %}
      </ul>
    </li>
  {% endfor %}
</ul>

Leave a comment