The UpdateAPIView is a subclass that updates a model’s fields using query parameters. In this video, learn how to create a subclass of UpdateAPIView that updates the fields of a shopping cart model from HTTP request parameters.
- [Narrator] Right now we can delete individual products. … That happens through the DestroyAPIView, … but what if we wanted to retrieve … an individual product's data? … We would have to create a new RetrieveAPIView … to handle the Get HTTP method. … And what if we also wanted to update and individual … products data, whether fully updating it … or partially updating it? … We would again have to create another APIView … this time using UpdateAPIView. … But why do all of that when we can just use … Django rest frameworks generic view … that combines all of those. … With the RetrieveUpdateDestroyAPIView … we cam reuse code and configuration. … For example, the serialiszer_class or queryset … and other configuration options for generic views. … And on top of that we can use … One URL to handle multiple HTTP methods. … To allow for this combination of actions … we're going to re-factor the ProductDestroyAPIView … into the RetrieveUPdateDestroyAPIView. … We need to import it … (typing) … and then re-factor …
- 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.