A

Admin • 828.03K Points
Coach

Q. How can you protect a view so that only authenticated users can access it?

  • (A) @authenticated_only
  • (B) @login_required
  • (C) @require_user
  • (D) @auth_required
  • Correct Answer - Option(B)
  • Views: 14
  • Filed under category Django
  • Hashtags:

Explanation by: Admin
Use `@login_required` to ensure the view is accessible only to logged-in users.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.