title: Shownig csrf verification failed in django
body: <p>When i click submit it is showing csrf verification failed eventhough i used {% csrftoken %}
  here my view.py:</p>
  
  <pre><code>@csrf_protect
  def register(request):
   if request.method == 'POST':
      form = RegistrationForm(request.POST)
      if form.is_valid():
          user = User.objects.create_user(
          username=form.cleaned_data['username'],
          password=form.cleaned_data['password1'],
          email=form.cleaned_data['email']
          )
          return HttpResponseRedirect('/login/')
  else:
      form = RegistrationForm()
  catagories = Company_Profile.objects.all()
  variables = RequestContext(request, {
  'form': form,'catagories' : catagories
  })
  
  return render_to_response(
  'index1.html',
  variables
  
  )
  </code></pre>
  
  <p>my html page index1.html s:</p>
  
  <pre><code>&lt;div id="connect_signup_box" class="connect_box_form clearfix"&gt;{% csrf_token  %}
  &lt;form enctype="application/x-www-form-urlencoded" class="global_form"  action="" method="POST"&gt;{% csrf_token %}&lt;div&gt;&lt;div&gt;&lt;h3&gt;Create Account&lt;/h3&gt;
  &lt;div class="form-elements" &gt;
  &lt;div id="name-wrapper" class="form-wrapper"&gt;&lt;div id="name-label"  class="form-label"&gt;&lt;label for="name" class="optional"&gt;Name&lt;/label&gt;&lt;/div&gt;
  &lt;div id="name-element" class="form-element"&gt;
  &lt;input type="text" name="name" id="name" value="" class="signup-name"&gt;&lt;/div&gt;     &lt;/div&gt;
  
  &lt;div id="username-wrapper" class="form-wrapper"&gt;&lt;div id="username-label"   class="form-label"&gt;&lt;label for="id_username"&gt;Username:&lt;/label&gt;&lt;/div&gt;
  &lt;div id="username-element" class="form-element"&gt;
  &lt;input id="id_username" max_length="30" name="username" required="True"  type="text"&gt;
  &lt;div id="uJTtr4FGLy-wrapper" class="form-wrapper"&gt;&lt;div id="uJTtr4FGLy-label"     class="form-label"&gt;&lt;label for="id_email"&gt;Email Id:&lt;/label&gt;&lt;/div&gt;
  &lt;div id="uJTtr4FGLy-element" class="form-element"&gt;
  &lt;input id="id_email" max_length="30" name="email" required="True"   type="text"&gt;
  &lt;p class="description"&gt;You will use your email address to login.&lt;/p&gt;&lt;/div&gt;   &lt;/div&gt;
  &lt;div id="password-wrapper" class="form-wrapper"&gt;&lt;div id="password-label"     class="form-label"&gt;&lt;label for="id_password1"&gt;Password:&lt;/label&gt;&lt;/div&gt;
  &lt;div id="password-element" class="form-element"&gt;
  &lt;input id="id_password1" name="password1" type="password"&gt;
  &lt;p class="description"&gt;Passwords must be at least 6 characters in length.    &lt;/p&gt;&lt;/div&gt;&lt;/div&gt;
  &lt;div id="passconf-wrapper" class="form-wrapper"&gt;&lt;div id="passconf-label"    class="form-label"&gt;&lt;label for="id_password2"&gt;Password (Confirm):&lt;/label&gt;&lt;/div&gt;
  &lt;div id="passconf-element" class="form-element"&gt;
  &lt;input id="id_password2" max_length="30" name="password2"    render_value="False" required="True" type="password"&gt;
  &lt;p class="description"&gt;Enter your password again for confirmation.&lt;/p&gt;&lt;/div&gt;   &lt;/div&gt;
  
  &lt;p class="description"&gt;This will be the end of your profile link, for   example: &lt;br&gt; &lt;/p&gt;&lt;/div&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;/div&gt;
  &lt;div id="terms-wrapper" class="form-wrapper"&gt;&lt;div id="terms-label"    class="form-label"&gt;&amp;nbsp;&lt;/div&gt;&lt;div id="terms-element" class="form-element"&gt;
  &lt;input type="hidden" name="terms" value=""&gt;&lt;input type="checkbox"    name="terms" id="terms" value="1" tabindex="7"&gt;
  &lt;label class="null" for="terms"&gt;I have read and agree to the &lt;a    target="_blank" href="help/terms.html"&gt;terms of service&lt;/a&gt;.&lt;/label&gt;&lt;/div&gt;&lt;/div&gt;
  &lt;div id="submit-wrapper" class="form-wrapper"&gt;&lt;div id="submit-label"     class="form-label"&gt;&amp;nbsp;&lt;/div&gt;&lt;div id="submit-element" class="form-element"&gt;
  &lt;input type="hidden" name="csrfmiddlewaretoken"    value="vmGTjibc4wzzsrVshrElFs8J0T24UECG"&gt;
          &lt;input type="submit" class="btn btn-success" value="submit"&gt;
  
      &lt;input type="reset" class="btn" value="cancel"&gt;
  
    &lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/form&gt;  &lt;/div&gt;
  
  &lt;/div&gt;
  </code></pre>
  
  <p>i am not using form.as_p since i need it individually to apply css..
  please help me</p>
  
  <p>edit:
   i got the answer
  the actual problem is i have hardcoded csrf i.e
     </p>
  
  <p>so removed it and it works fine. thanks to @ Daniel Roseman who noticed me that and thanks to all for helping me.</p>