Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

116
Views
csrftoken tag not working after upgrade to Django 1.11

I have inherited a Django app that I initially got working on Django 1.9. Recently I have migrated it to Django 1.11 and Python 3.4 (from 2.7). Since then, some admin view that I have has started failing with a 403 Forbidden error, CSRF verification failed. I looked at the documentation, and checked the following things:

  1. I'm still using MIDDLEWARE_CLASSES, but django.middleware.csrf.CsrfViewMiddleware is included in my configuration (it's second, after SessionMiddleware and CommonMiddleware).
  2. The template used includes the {% csrf_token %} stuff.
  3. The view uses render_to_response(), and passes RequestContext(request) as the third argument to it.

(None of these changed during or after the Django/Python upgrades, as far as I know.)

I'm not that experienced with Django, although I have quite a bit of Python web programming experience. What am I missing/how could I debug further?

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

The context_instance parameter was deprecated in 1.8 and was subsequently removed in 1.10. If you need the request in the context, use render() instead and pass the request as the first argument. You should pass the context as a plain dictionary in the third parameter.

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!