title: Display many to many relation relations in the template
body: <p>First of all I will post all the possibly necessary code. <strong>My models</strong>:</p>
  
  <pre><code>class topic(models.Model):
          learningObjectivesTopic = models.ManyToManyField(learningObjective, verbose_name = "Lernziel")
          topic = models.TextField(verbose_name = 'Thema')                         
  
  class learningObjective(models.Model):
          learningObjectives = models.TextField(verbose_name = 'Lernziel')
  </code></pre>
  
  <p><strong>My views:</strong></p>
  
  <pre><code>@login_required(login_url='login')
  def lernziel(request):
          return render(request, 'lernziel.html', {'topic': topic.objects.all(), 'todo': todoList.objects.all()})
  
  @login_required(login_url='login')
  def create_lernziel(request):
          neuesLernziel=learningObjective(learningObjectives=request.POST['Lernziel'])
          neuesLernziel.save()
          neuesLernziel_Topic=topic.objects.get(topic=request.POST['Thema'])
          neuesLernziel_Topic.learningObjectivesTopic.add(neuesLernziel)
          return render(request, 'lernziel.html', {'topic': topic.objects.all(), 'todo': todoList.objects.all()})
  </code></pre>
  
  <p>And the <strong>template</strong> I am using:</p>
  
  <pre><code>&lt;html lang="{{ LANGUAGE_CODE|default:"de-de" }}" &gt;
  &lt;head&gt;
  &lt;h1 align = "center"&gt;Lernziele&lt;/h1&gt;
  &lt;/head&gt;
  
  &lt;body&gt;
  
  &lt;form action="{% url 'create_lernziel' %}" method="post"&gt;
  {% csrf_token %}
  &lt;br&gt;Hallo Benutzer: {{ user.username }}&lt;/br&gt;
  Lernziel: &lt;textarea name="Lernziel" rows="3" cols="45" &gt;&lt;/textarea&gt;
  &lt;p&gt;
   &lt;select name="Thema" size="5"&gt;
    {% for topic_ in topic %}
     &lt;option&gt;{{ topic_.topic }}&lt;/option&gt;
    {% endfor %}
   &lt;/select&gt;
  &lt;/p&gt;
  &lt;input type="submit" value="Absenden" /&gt;
  &lt;/form&gt;
  
  {% comment %}
  Here should be the table which displays learning objectives and the related topics
  {% endcomment %}
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>Ok I know my question is a bit weird because I don't have directly wrong code that I am posting. But I tried it so many times to display what I want properly but I just don't get how to do it right. My aim is to have 2 columns/headers: [learning objective] and [topics]. For every learning objective I want to have a new row. And in every row, it is possible to display more topics in relation. If you need more information or want me to be more specific about my problem please post it in the comments :)</p>
  
  <p><strong>Edit</strong> my first thought of that structure was that one: I iterate through the learning objectives, create a row for each one and and list the learning objectives and topics in that row then. Apparently it's not working. The Table probably has to be dynamic so that my idea is working or I just had a wrong thought.</p>
  
  <pre><code>&lt;table border="1"&gt;
  &lt;th&gt;Lernziel&lt;/th&gt;
  &lt;th&gt;Thema&lt;/th&gt;
  
  {% for topic_ in topic %}
  
          {% for lObj in topic_.learningObjectivesTopic.all %}
                  &lt;tr&gt;&lt;td&gt;{{ lObj }}&lt;/td&gt;
          {% endfor %}
  
          &lt;td&gt;{{ topic_.topic }}&lt;/td&gt;&lt;/tr&gt;
  
  {% endfor %}
  
  &lt;/table&gt;
  </code></pre>