title: django post_delete() signal handler doesn't work
body: <p>I am trying to make it so that the 'num_posts' field of a blog object is decremented every time a post belonging to that blog is deleted, and incremented every time a post is created. I was able to implement the overloaded save method easily enough:</p>
  
  <pre><code>def save(self, *args, **kwargs):
      '''After saving a new post, increment the num_posts value in the
      relevant blog.'''
      super(Posts, self).save(*args, **kwargs)
      self.blog_id.num_posts += 1
      tmp = self.blog_id
      tmp.save()
  </code></pre>
  
  <p>But for whatever reason, the logic does not work when deleting a Posts object. I'm following best practices by using signal handlers in a <code>handlers.py</code> file in a signals submodule. I then import the submodule in my <code>ready()</code> method in my <code>TasksConfig(Appconfig)</code> method in <code>apps.py</code></p>
  
  <p>I don't seem to be getting any syntax errors, or any errors at all. The <code>num_posts</code> field on the relevant blog simply fails to decrement. Here is the relevant code:</p>
  
  <p>From my <code>handlers.py</code>:</p>
  
  <pre><code>from django.db.models.signals import pre_delete
  from django.dispatch import receiver
  from webcomics.models import Pages, Posts, Blogs
  
  @receiver(pre_delete, sender=Pages)
  def handle_page_delete(sender, **kwargs):
      obj = kwargs['instance']
  
      if(obj != None):
          tmp1 = obj.prev_id
          tmp2 = obj.next_id
  
      if(tmp1 != None):
          tmp1.next_id = tmp2
          obj.prev_id = None
  
      if(tmp2 != None):
          tmp2.prev_id = tmp1
          obj.next_id = None
  
  
  @receiver(pre_delete, sender=Posts)
  def handle_bpost_delete(sender, **kwargs):
      obj = kwargs['instance']
  
      if(obj != None):
          tmp = Blogs.objects.get(pk = obj.blog_id)
          tmp.num_pages = tmp.num_pages - 1
  </code></pre>
  
  <p>From my <code>apps.py</code>:</p>
  
  <pre><code>from django.apps import AppConfig
  
  class WebcomicsConfig(AppConfig):
      name = 'webcomics'
  
  
  class TasksConfig(AppConfig):
      name = 'tasks'
      verbose_name = "Tasks"
  
      def ready(self):
          import binshellpress.webcomics.signals.handlers
  </code></pre>
  
  <p>Also, here is the full Posts object in <code>models.py</code>, just in case you guys can see something I'm missing:</p>
  
  <pre><code>class Posts(models.Model):
      title = models.CharField(max_length=180)
      pub_date = models.DateTimeField('date publishied', default=timezone.now)
      blog_id = models.ForeignKey('Blogs', on_delete=models.CASCADE)
      series_id = models.ForeignKey('Series', on_delete=models.SET_NULL,
                                    blank=True, null=True)
  
      # Note: Vanilla TinyMCE Integration seems to be working. Need to
      # modify the implementation to handle links, images, etc.
      data = HTMLField()
  
      def __str__(self):
          return self.title
  
      def save(self, *args, **kwargs):
          '''After saving a new post, increment the num_posts value in the
          relevant blog.'''
          super(Posts, self).save(*args, **kwargs)
          self.blog_id.num_posts += 1
          tmp = self.blog_id
          tmp.save()
  </code></pre>
  
  <p>I suspect that it is something obvious. I'm just at a loss because there doesn't seem to be any error message coming from anywhere.</p>