code: def edit_post(request, post_id):
      
      post   = get_object_or_404(Post, id=post_id)
      user   = request.user
  
      topic  = post.topic
      # oughta build a get_absolute_url method for this, maybe.
      post_url = '{0}page{1}/#post{2}'.format(topic.get_short_url(), topic.page_count, post.id)
  
      if topic.is_locked:
          messages.error(request, 'Sorry, but this topic is closed')
          return HttpResponseRedirect(post_url)
  
      if user.is_staff is False and user.id != post.author.id:
          messages.error(request, "Sorry, but you can't edit this post.")
          return HttpResponseRedirect(post_url)
  
      if request.POST and len(request.POST['text']) > 1:
          if request.is_ajax and 'body' in request.POST:  # AJAX REQUEST
              post.text = request.POST['body']
              post.save(update_fields=['text', 'text_formatted'])
              return HttpResponse(str(post.text))
          post.text = request.POST['text']
          post.save(update_fields=['text', 'text_formatted'])
  
          if 'name' in request.POST:  # updated topic
              topic.name = request.POST['name']
              topic.save(update_fields=['name'])
          return HttpResponseRedirect(post_url)
      # this is a get request
      else:
          if post == topic.post_set.all()[0]:
              form = AddTopicForm(instance=topic, initial={'text': post.text})
          else:
              form = PostForm(instance=post)
          return render(request, 'fretboard/add_edit.html', {
              'quote': post.quote,
              'form' : form,
              'form_title': 'Edit post',
          })
docs: Allows user to edit an existing post.
      This needs to be rewritten. Badly.