title: django manytomany field update
body: <p>I have a book which is contained in 3 categories. </p>
  
  <p>Now i am making it possible to edit the book informations and also change the category. I am stuck in updating the categories of the book because there is ManyToMany Relation between Book and category. </p>
  
  <p>here is how i am trying to update each category: </p>
  
  <pre><code>book = Book.objects.get(id=bookid)
  newcategory1 = Category.objects.get(id=int(request.POST.get('cat1')))
  newcategory2 = Category.objects.get(id=int(request.POST.get('cat2')))
  newcategory3 = Category.objects.get(id=int(request.POST.get('cat3')))
  
  book.cat.order_by('id')[:1] = cat1
  book.cat.order_by('id')[1:2] = cat2
  book.cat.order_by('id')[2:3] = cat3 
  </code></pre>
  
  <p>but it is saying: </p>
  
  <pre><code>'QuerySet' object does not support item assignment
  </code></pre>
  
  <p>Relation</p>
  
  <pre><code>class Category(models.Model):
    CATS = (
      ('Art', 'Art'),
      ('Sport', 'Sport and Athletics'),
      ('Science', 'Science Discovery'),        
    )
    cat = models.CharField(max_length=2, choices=CATS,unique=True)
  
  
  class Book(models.Model):
    title = models.TextField()
    subtitle = models.TextField()
    cat = models.ManyToManyField(Category)
  </code></pre>
  
  <p>I am reading about <code>add()</code> and <code>remove()</code> methods.. how can I update the categories of the existing book with existing categories? </p>