Learn how to use a serializer with an APIView subclass. This video covers how APIViews speed up creation of APIs, why you should prefer them, and the cases where you may want not want to use them.
- [Instructor] We have a Serializer for products. … Now let's create a List API View … to use the Product Serializer. … The API is going to return the list of products … and render them into JSON. … A ListAPIView is a generic class-based view. … Django REST Framework provides … a number of generic API Views and mixins … that can help speed up development. … We create the API View's file. … From rest_framework.generics we import ListAPIView. … We import our Serializer, … and we import our model. … Now we can create our ProductList Api View. … Set the queryset to all products that exist in our database, … and the Serializer class is the Product Serializer, … which we created. … And that's it. … By using the generic ListAPIView, … we only need to define a few configuration fields. … The API View will take care of … the rendering of the serialized data into the JSON format. … The generic views in Django REST framework … will cover what you need from a REST API in many cases. … There are rare cases where …
- Creating a serializer
- Working with API views
- Filtering back ends
- Enabling pagination
- Executing CRUD operations
- Managing serializer fields
- Testing API views
Skill Level Intermediate
Deploying Django Apps: Make Your Site Go Livewith Nick Walter2h 43m Intermediate
Demo project overview1m 19s
1. Serializing, Listing, Filtering, and Paginating Models
2. Create, Retrieve, Update, and Delete (CRUD) Operations for Models
3. Managing Serializer Fields, Relations, and Validation
4. Testing API Views
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.