title: how to display many to many field properly in django
body: <p>This code saves the data and displays the data as i wanted.but while displaying courses it displays like this <strong>, ]></strong> .It displays with 
  QuerySet[].i only want the courses name to be displayed.How can i do that</p>
  
  <blockquote>
    <p>models.py</p>
  </blockquote>
  
  <pre><code>class Teacher(models.Model):
      name = models.CharField(max_length=50)
      address = models.CharField(max_length=50)
      phone = models.CharField(max_length=15)
      email = models.EmailField()
      image = models.ImageField(upload_to='Teachers',blank=True)
      courses = models.ManyToManyField(Course)
  </code></pre>
  
  <blockquote>
    <p>views.py</p>
  </blockquote>
  
  <pre><code>def viewteacher(request):
          teachers = Teacher.objects.all().order_by('-joined_date')
          year1 = datetime.datetime.today().year
  
          return render(request,'students/view_teacher.html',{'teachers':teachers,'year_list':range(2016,year1+1)})
  </code></pre>
  
  <blockquote>
    <p>template
    </p>
  </blockquote>
  
  <pre><code>  {% for teacher in teachers %}
                  &lt;tr&gt; 
                      &lt;td&gt;{{teacher.name}}&lt;/div&gt;&lt;/td&gt;
                          &lt;td&gt;{{teacher.courses.all}}&lt;/td&gt;
                          &lt;td&gt;{{teacher.address}}&lt;/td&gt;
                          &lt;td&gt;{{teacher.phone}}&lt;/td&gt;
                          &lt;td&gt;&lt;a href="{% url 'students:profile_teacher' teacher.id %}"&gt;Profile&lt;/a&gt;&lt;/td&gt;
                          &lt;td&gt;&lt;a href="{% url 'students:edit_teacher' teacher.id %}"&gt;Edit&lt;/a&gt;&lt;/td&gt;
                          &lt;td&gt;&lt;a href="{% url 'students:confirm_delete_teacher' teacher.id %}"&gt;Delete&lt;/a&gt;&lt;/td&gt;
                      &lt;/tr&gt;
                     {% endfor %}
                  &lt;/tbody&gt;
  </code></pre>