title: Django 403 CSRF Verification Failed
body: <p>I'm writing an enrollment website for my school, and using Django for the framework. For the registration, I require a username, password, and registration token. Those have yet to be validated, all I'm attempting to do right now is go from the registration input page (which uses a POST request) to a "You have successfully registered" page. Somewhere along the line, the csrf token is apparently refusing to be validated. </p>
  
  <p>My view:</p>
  
  <pre><code>def register(request):
      return render(request, 'enroller/successfulEnroll.html')
  </code></pre>
  
  <p>My page:    </p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html lang="en"&gt;
  &lt;head&gt;
      &lt;meta charset="UTF-8"&gt;
      &lt;title&gt;Title&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
      &lt;form action="{% url 'register' %}" method="post"&gt; {% csrf_token %}
      &lt;div class="container"&gt;
          &lt;label&gt;&lt;b&gt;New Username&lt;/b&gt;&lt;/label&gt;
          &lt;input type="text" placeholder="Username" name="uname" required&gt;
          &lt;br&gt;
          &lt;label&gt;&lt;b&gt;Password&lt;/b&gt;&lt;/label&gt;
          &lt;input type="password" placeholder="Password" name="psw" required&gt;
          &lt;br&gt;
          &lt;label&gt;&lt;b&gt;Registration Password&lt;/b&gt;&lt;/label&gt;
          &lt;input type="text" placeholder="Registration Key" name="reg" required&gt;
          &lt;br&gt;
          &lt;input type="submit" value="Register" /&gt;
      &lt;/div&gt;
      &lt;/form&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>When I attempt to go from the registration page to the success page, it gives me an error 403 (CSRF Verification failed. Request aborted). However, when I attempt to go to the url mysite.com/register/, it returns the page I requested with no error. </p>
  
  <p>Is there any way to fix this? I've been looking at RequestContext, but I'm not entirely sure where it would be used.</p>