title: Django: One-to-many relationship update
body: <p>I am not sure how to describe this properly. But my models look like these:</p>
  
  <pre><code>class Post(models.Model):
      title = models.CharField(max_length=250)
      body = models.TextField()
      published = models.DateTimeField(null=True, blank=True)
      updated = models.DateTimeField(null=True, blank=True)
      user = models.ForeignKey(User)
  
  class Unread(models.Model):
      user = models.ForeignKey(User)
      post = models.ForeignKey(Post)
  </code></pre>
  
  <p>My problem is when I try to UPDATE the Unread Model. Lets say in my "<strong>userlist</strong>" I have <em>user ids</em>: <code>[1,3,5]</code></p>
  
  <p>My Unread model has:</p>
  
  <pre><code>ID   USER   POST
  1    1      1  # will row will remain because userid 1 is found in "userlist"
  2    2      1  # --- this row would be deleted because USER is not found in "userlist"
  3    3      1  # will also remain because userid 3 is found in "userlist"
  4    5      1  # NEW RECORD added because 5 was in "userlist" but not in Unread
  </code></pre>
  
  <p>Note: ID is autoincrement.</p>
  
  <p>Does Django have an "automatic" way of doing this? Or what is the "recommended" way of handling these types of scenario?</p>
  
  <p>I have encountered this problem a few times before and I remember that the "laziest" way I handled this was to DELETE everything in the Unread model and then ADD everything from the "userlist".</p>
  
  <p>Best Regards,
  W</p>