Q. Which Django view decorator is used to allow only staff users?

  • (A) @staff_only
  • (B) @user_passes_test
  • (C) @staff_required
  • (D) @user_required
πŸ’¬ Discuss
βœ… Correct Answer: (B) @user_passes_test
Explanation: `@user_passes_test(lambda u: u.is_staff)` is used to restrict views to staff users.
Explanation by: Mr. Dubey
`@user_passes_test(lambda u: u.is_staff)` is used to restrict views to staff users.

πŸ’¬ Discussion


πŸ“Š Question Analytics

πŸ‘οΈ
84
Total Visits
πŸ“½οΈ
1 y ago
Published
πŸŽ–οΈ
Mr. Dubey
Publisher
πŸ“ˆ
97%
Success Rate