Bird
0
0

Which of the following is a built-in permission class in Django REST Framework that allows access only to admin users?

easy📝 Conceptual Q1 of 15
Django - DRF Advanced Features
Which of the following is a built-in permission class in Django REST Framework that allows access only to admin users?
AIsAuthenticatedOrReadOnly
BIsAdminUser
CAllowAny
DIsAuthenticated
Step-by-Step Solution
Solution:
  1. Step 1: Review built-in DRF permission classes

    DRF provides several built-in permission classes like IsAuthenticated, AllowAny, IsAdminUser, and IsAuthenticatedOrReadOnly.
  2. Step 2: Identify permission for admin-only access

    IsAdminUser restricts access to users with admin status, which matches the requirement.
  3. Final Answer:

    IsAdminUser -> Option B
  4. Quick Check:

    Admin-only access = IsAdminUser [OK]
Quick Trick: Admin-only access uses IsAdminUser permission [OK]
Common Mistakes:
MISTAKES
  • Confusing IsAuthenticated with admin-only access
  • Using AllowAny which allows all users
  • Choosing IsAuthenticatedOrReadOnly which allows read for all

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Django Quizzes