title: Order template when using _set.all
body: <p>I want to order some element of template by "anno" but I don't know how or where (if from views or template). I tried whit |dictsort: but I think i've miss something or wrong something else. Could you help me, please...???!!! Thanks...</p>
  
  <p>my models.py :</p>
  
  <pre><code>class Anno( models.Model ):
      anno = models.CharField( max_length=4 )
      def __unicode__(self):
          return self.anno
      class Meta:
          verbose_name_plural = "Anni"
  
  class Sequel_Film( models.Model ):
      saga = models.CharField( max_length=30 )
      def __unicode__(self):
          return self.saga
      class Meta:
          verbose_name_plural = "Sequels"
  
  class Film( models.Model ):
      titolo = models.CharField( max_length=39 )
      trama = models.TextField( max_length=1000 )
      locandina = models.FilePathField( path="C:/Users/Federico/Google Drive/Umore/apps/Database/static/Film/Locandina", recursive=True )
      copertina = models.FilePathField( path="C:/Users/Federico/Google Drive/Umore/apps/Database/static/Film/Copertina", recursive=True )
      trailer = models.FilePathField( path="C:/Users/Federico/Google Drive/Umore/apps/Database/static/Film/Trailer", recursive=True )
      data_inserimento = models.DateField( null=True, verbose_name="data d'inserimento" )
      anno = models.ForeignKey( Anno )
      durata = models.IntegerField( max_length=5 )
      attori = models.ManyToManyField( Attore )
      registi = models.ManyToManyField( Regista )
      studi = models.ManyToManyField( Studio )
      umori = models.ManyToManyField( Umore )
      generi = models.ManyToManyField( Genere_Film )
      sequels = models.ManyToManyField( Sequel_Film )
      def __unicode__(self):
          return self.titolo + " " + self.trama
      class Meta:
          verbose_name_plural = "Films"
  </code></pre>
  
  <p>my views.py :</p>
  
  <pre><code>def film(request, id):
      film = get_object_or_404( Film, pk=id )
      return render_to_response('Film.html', { 'film': film })
  </code></pre>
  
  <p>my template Film.html :</p>
  
  <pre><code>  {% for sequel in film.sequels.all %}
      {% for film in sequel.film_set.all %}
      {% endfor %}
    {% endfor %}
  </code></pre>
  
  <hr>
  
  <p>But between the tags in the template there is...</p>
  
  <pre><code>  {% for sequel in film.sequels.all %}
    {% for film in sequel.film_set.all %} #{% for sequel_film in sequel.ordered_film_set %}
    &lt;div class="clear paddingT15"&gt;&amp;nbsp;&lt;/div&gt;
    &lt;div class="grid_11"&gt;
      &lt;div class="grid_9"&gt;
        &lt;h3&gt;&lt;a class="black hover" href="/Database/Film/{{ film.id }}"&gt;{{ film.titolo }}&lt;/a&gt;&lt;/h3&gt;
      &lt;/div&gt;
      &lt;div class="grid_2 right"&gt;
        &lt;p class="marginB10"&gt;&lt;img class="h20 w20 marginT-4" src="stella.jpg"&gt;&lt;img class="h20 w20 marginT-4" src="stella.jpg"&gt;&lt;img class="h20 w20 marginT-4" src="stella.jpg"&gt;&lt;img class="h20 w20 marginT-4" src="stella.jpg"&gt;&lt;img class="h20 w20 marginT-4" src="stella.jpg"&gt;&lt;/p&gt;
      &lt;/div&gt;
      &lt;div class="clear"&gt;&amp;nbsp;&lt;/div&gt;
      &lt;div class="grid_2 paddingR15"&gt;
        &lt;a href="/Database/Film/{{ film.id }}"&gt;&lt;img class="w120 h165" src="Eagle-eye.jpg" &gt;&lt;/a&gt;
      &lt;/div&gt;
      &lt;div class="grid_3"&gt;
        &lt;p class="marginB10 bold color"&gt;{% for umori in film.umori.all %}{{ umori.umore }}&lt;br&gt;{% endfor %}&lt;/p&gt;
      &lt;/div&gt;
      &lt;div class="grid_3"&gt;
        &lt;p class="marginB10 bold color"&gt;{% for generi in film.generi.all %}{{ generi.genere }}&lt;br&gt;{% endfor %}&lt;/p&gt;
      &lt;/div&gt;
      &lt;div class="grid_1"&gt;
        &lt;p class="marginB10 bold color"&gt;{{ film.anno }}&lt;br&gt;{{ film.durata }} min.&lt;/p&gt;
      &lt;/div&gt;
      &lt;div class="grid_2 bordoL2 floatR marginR-30"&gt;
        &lt;div class="grid_2 Lheight10"&gt;
      &lt;p class="color marginL5 marginB10 size12"&gt;Visto:&lt;span class="bold"&gt;No&lt;/span&gt;&lt;/p&gt;
        &lt;/div&gt;
        &lt;div class="grid_2"&gt;
      &lt;p class="color marginL5 marginB10 size12"&gt;Umore:&lt;span class="bold"&gt;&lt;/span&gt;&lt;/p&gt;
        &lt;/div&gt;
        &lt;div class="grid_2"&gt;
      &lt;p class="color marginL5 marginT-5 size12"&gt;Vota: &lt;img class="h10 w10" src="nessuno.jpg"&gt;&lt;img class="h10 w10" src="nessuno.jpg"&gt;&lt;img class="h10 w10" src="nessuno.jpg"&gt;&lt;img class="h10 w10" src="nessuno.jpg"&gt;&lt;img class="h10 w10" src="nessuno.jpg"&gt;&lt;/p&gt;
        &lt;/div&gt;
      &lt;/div&gt;
      &lt;p class="recensione_a"&gt;Iauhc iewohafiuhedpidheas wpid wei eiageiweg wiieadfef iuadgqef iupi hi eri haiu reiugsi4fri sireehre efi iviviu rier ef uviu li elu riwf iuh ger iugeiu Iauhc iewohafiuhedpidheas wpid wei eiageiweg wiieadfef iuadgqef iupi hi eri haiu reiugsi4fri sireehre efi iviviu rier ef uviu li elu riwf iuh ger iugeiu&lt;/p&gt;
      &lt;div class="clear"&gt;&amp;nbsp;&lt;/div&gt;
    &lt;/div&gt;
    &lt;div class="clear paddingT15"&gt;&amp;nbsp;&lt;/div&gt;
    {% endfor %}
    {% endfor %}
  </code></pre>
  
  <p>How I have to use {{sequel_film}} ??? Sorry but I don't understand...</p>