A

Admin • 833.24K Points
Coach

Q. How can you protect a Django view from CSRF attacks?

  • (A) By adding {% csrf_protect %} in template
  • (B) By using csrf_token in form and CsrfViewMiddleware
  • (C) By hashing the form data
  • (D) By encoding URLs
  • Correct Answer - Option(B)
  • Views: 29
  • Filed under category Django
  • Hashtags:

Explanation by: Admin

Django uses `csrf_token` in forms and `CsrfViewMiddleware` to protect against CSRF attacks.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.