title: Django: How can I add weight/ordering to a many to many relationship?
body: <p>I'm having Pages with TextBlocks on them. Text Blocks may appear on different pages, pages may have several text blocks on them. Every page may have these blocks in an ordering of it's own. 
   This can be solved by using a separate <em>through</em> parameter. Like so:</p>
  
  <pre><code>class TextBlock(models.Model):
      title = models.CharField(max_length=255)
      text = models.TextField()
  
  class Page(models.Model):
      textblocks = models.ManyToManyField(TextBlock, through=OrderedTextBlock)
  
  class OrderedTextBlock(models.Model):
      text_block = models.ForeignKey(TextBlock)
      product_page = models.ForeignKey(Page)
      weight = models.IntegerField()
  
      class Meta:
          ordering = ('weight',)
  </code></pre>
  
  <p>But I'm not very enthousiastic about the violations of DRY for my app. (There's a lot of ordered ManyToMany relations). Is there a recommended way to go about this?</p>
  
  <p>Edit: typo</p>