From the course: Building React and Django Apps
Creating a ViewSet with Django
From the course: Building React and Django Apps
Creating a ViewSet with Django
- [Instructor] We're going to create a view set for the tour packages by reusing the existing package serializer. We already have a view set for creating and updating packages, but that's for administrative users to use. What we want is a public list of packages for anyone to access. We create a public package view set, and with the permission classes, set to token has scope. All users will have permission to access the list and they will only need the read scope on their Oauth token. All packages will be returned from this API end point in descending order by price and here's where we reuse the package serializer class. Now in the URLs configuration, we add a new route to the Django rest framework default router.
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
Creating a ViewSet with Django1m 2s
-
(Locked)
Displaying a list of items with React2m 47s
-
Deleting an item using React and Django1m 49s
-
(Locked)
Partially updating an item using React1m 50s
-
(Locked)
Pagination with Django38s
-
(Locked)
Pagination with React3m 31s
-
(Locked)
Filtering with Django1m 56s
-
(Locked)
Filtering with React4m 44s
-
-
-
-
-