title: how to get POST data in django 1.3
body: <p>Hey, I am following this tutorial to learn to make a wiki page with Django. However, it is made in django 0.96 and I use Django 1.3 so there are some things that are different. Some I already fixed myself, however this one I can't seem to make it work.</p>
  
  <p>I made a form that submits data to a view.
   This is the form:</p>
  
  <pre><code>&lt;form method="post" action"/wikicamp/{{page_name}}/save/"&gt;{% csrf_token %}
      &lt;textarea name="content" rows="20" cols="60"&gt;{{content}}&lt;/textarea&gt;&lt;br&gt;
      &lt;input type="submit" value="Save Page"/&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>and the /wikicamp/{{page_name}}/save/ url redirects to the save_page view:</p>
  
  <pre><code>from django.http import HttpResponseRedirect
  from django.core.context_processors import csrf
  
  def save_page(request, page_name):
      c = {}
      c.update(csrf(request))
      content = c.POST["content"]
      try:
          page = Page.objects.get(pk=page_name)
          page.content = content
      except Page.DoesNotExist:
          page = Page(name=page_name, content=content)
      page.save()
      return HttpResponseRedirect("wikicamp/" + page_name + "/")
  </code></pre>
  
  <p>However the problem is that I get this error:</p>
  
  <pre><code>Help
  
  Reason given for failure:
  
      CSRF token missing or incorrect.
  
  
  In general, this can occur when there is a genuine Cross Site Request Forgery, or when Django's CSRF mechanism has not been used correctly. For POST forms, you need to ensure:
  
      The view function uses RequestContext for the template, instead of Context.
      In the template, there is a {% csrf_token %} template tag inside each POST form that targets an internal URL.
      If you are not using CsrfViewMiddleware, then you must use csrf_protect on any views that use the csrf_token template tag, as well as those that accept the POST data.
  
  You're seeing the help section of this page because you have DEBUG = True in your Django settings file. Change that to False, and only the initial error message will be displayed.
  
  You can customize this page using the CSRF_FAILURE_VIEW setting.
  </code></pre>
  
  <p>So I read through some of the documentation, like <a href="http://docs.djangoproject.com/en/dev/ref/contrib/csrf/#how-to-use-it" rel="noreferrer">http://docs.djangoproject.com/en/dev/ref/contrib/csrf/#how-to-use-it</a>. I tried to do that however and it still gave the same error.</p>
  
  <p><strong>So: Anyone an idea how to handle form post data well with Django 1.3?</strong></p>
  
  <p>I think it has something to do with: The view function uses RequestContext for the template, instead of Context. but i don't now what it is.</p>
  
  <p>btw, in my terminal which shows the http request of the localhost it says this: A {% csrf_token %} was used in a template, but the context did not provide the value. This is usually caused by not using RequestContext. </p>