Django Bug Hunt Easy +10 XP
Missing CSRF Token
POST form returns 403 Forbidden.
DjangoFind the bug
1
<form method='post'>2
<input type='text' name='email'>3
<button type='submit'>Send</button>4
</form> The bug is on line 1
Select the correct fix
Show answer and explanation
Answer: Add {% csrf_token %} inside the form
Django's CSRF middleware requires a token in every POST form. Add {% csrf_token %} right after the opening form tag.
Hint: Django blocks POST requests without a CSRF token.
What this challenge tests
Bug Hunt in Django: csrf, security, forms.