'Override delete method to update parent thread info.'

def delete(self, *args, **kwargs):

    thread = Thread.objects.get(pk=self.thread.id)
    if (thread.last_post_id and (thread.last_post_id == self.id)):
        thread.update_last_post(exclude_post=self)
    thread.replies = (thread.post_set.count() - 2)
    thread.save()
    super(Post, self).delete(*args, **kwargs)
    if (thread.last_post is None):
        thread.delete()
