Bird
0
0

Which router type in Django REST Framework automatically creates routes for all standard actions of a ViewSet and includes a default API root view?

easy📝 Conceptual Q2 of 15
Django - REST Framework Basics
Which router type in Django REST Framework automatically creates routes for all standard actions of a ViewSet and includes a default API root view?
ASimpleRouter
BDefaultRouter
CCustomRouter
DManualRouter
Step-by-Step Solution
Solution:
  1. Step 1: Recall router types in DRF

    DefaultRouter automatically creates routes including a default API root view.
  2. Step 2: Compare with SimpleRouter

    SimpleRouter creates routes but does not include the API root view.
  3. Final Answer:

    DefaultRouter -> Option B
  4. Quick Check:

    Router with API root = DefaultRouter [OK]
Quick Trick: DefaultRouter adds API root view automatically [OK]
Common Mistakes:
MISTAKES
  • Confusing SimpleRouter with DefaultRouter
  • Assuming CustomRouter is built-in
  • Thinking ManualRouter is a DRF class

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Django Quizzes