Grokking Django
0% completed
ViewSets, Routers, and Pagination
The two generic views from the previous lesson repeat the same three settings: the queryset, the serializer class and the permission classes. You also wrote two URL patterns by hand, one for the list and one for a single article. Both views describe one resource, the blog's articles, so DRF lets you write them as one class and generate the URLs for you.
A class that holds every action for one resource is a viewset, and the object that turns a viewset into URL patterns is a router. This lesson replaces ArticleListCreateView and `ArticleDetailView
.....
.....
.....
Like the course? Get enrolled and start learning!
Reading Progress
0%