code: def delete_post(request, post_id, topic_id):
      
      try:
          topic = Topic.objects.get(id=topic_id)
          post = Post.objects.get(id=post_id)
      except:
          messages.error(request, 'Sorry, but this post can not be found. It may have been deleted already.')
          raise Http404
      return_url = "/forum/%s/%s/%s/" % (topic.forum.slug, topic.slug, topic_id)
      if request.user.is_authenticated() and (request.user.is_staff or request.user.id == post.author.id):
          post.delete()
          update_post_relations(request.user, topic, deleting=True)
          topic_posts = topic.post_set.count()
          pmax = (topic_posts / PAGINATE_BY) + 1
  
          # if no posts are left, delete topic.
          if topic_posts == 0:
              topic.delete()
              return HttpResponseRedirect("/forum/%s/" % topic.forum.slug)
  
          return HttpResponseRedirect("%spage%s/" % (return_url, pmax))
      else:
          raise Http404
docs: Deletes a post, if the user has correct permissions.
      Also updates topic.post_count