Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Python Django Forms Forms Handling a Form in a View

Iskander Ismagilov
Iskander Ismagilov
13,298 Points

CSRF token missing or incorrect ['SOLVED']

Hi, everybody! Does somebody can help with this:

When I fill the form and put "submit", instead of page stay as it should be, it shows:

Forbidden (403)

CSRF verification failed. Request aborted. Reason given for failure: CSRF token missing or incorrect.

What can be wrong?

2 Answers

had same problem, this was due to cached copy of the previous form being displayed, and I clicked submit

Do you have {% csrf_token %} in between the opening and closing form tags in your templates/suggestion_form.html?

Iskander Ismagilov
Iskander Ismagilov
13,298 Points

Yes I have put it. I do not know where the problem was exactly, but it got solved by it self, so now everything is ok. Thanks anyway.