Skip to main content
Loading page…
Python Mastery
Chapter 35
Lesson 2 of 4
Views, ViewSets & Routers
Contents
Notes
Tutor
Concept
The View Hierarchy
Loading activity…
Previous
1 / 9
Continue
Contents
Notes
Discussion
Tutor
51 min
9 activities
0 of 9 done
In this lesson
1
The View Hierarchy
2
APIView — Explicit Method Handlers
3
Generic Views — Half the Code
4
ViewSets and Routers — Automatic URL Routing
5
ModelViewSet vs ReadOnlyModelViewSet
6
Order the DRF Request Lifecycle
7
Generic Views — Match to HTTP Operation
8
Router basename — When is it Required?
9
Senior Lab: Build, Run, and Review Evidence
Objectives
Learner can write an APIView subclass with get() and post() methods
Learner can use generic views (ListCreateAPIView, RetrieveUpdateDestroyAPIView) to reduce boilerplate
Learner can build a ViewSet and register it with a Router to get automatic URL patterns
Learner can use the browsable API to explore and test endpoints
Learner can return correct HTTP status codes using DRF's status module
Further reading
Django REST Framework documentation
Chapter 35 · REST APIs with Django REST Framework
Serializers
Views, ViewSets & Routers
Authentication & Permissions
A Complete REST API
Previous: Serializers
Next: Authentication & Permissions