title: Django: accessing ManyToManyField objects after the save
body: <p>This is baffling me... When I save my model, the book objects are unchanged. But if I open the invoice and save it again, the changes are made. What am I doing wrong?</p>
  
  <pre><code>class Invoice(models.Model):
      ...
      books = models.ManyToManyField(Book,blank=True,null=True)
      ...
  
      def save(self, *args, **kwargs):
          super(Invoice, self).save(*args, **kwargs)
          for book in self.books.all():
              book.quantity -= 1
              if book.quantity == 0:
                  book.sold = True;
              book.save()
  </code></pre>
  
  <p><strong>Edit:</strong> I've tried using the post_save signal, but it works the same way. No changes on the first save, changes saved the second time.</p>
  
  <p><strong>Update:</strong> Seems to be solved with this code:</p>
  
  <pre><code>class InvoiceAdmin(admin.ModelAdmin):
      ...
  
      def save_model(self, request, obj, form, change):
          obj.save()
          for bk in form.cleaned_data['books']:
              book = Book.objects.get(pk=bk.id)
              book.quantity -= 1
              if book.quantity == 0:
                  book.sold = True;
              book.save()
  </code></pre>