In Part 1, we were writing a BookViewSet. You can pull out the method that contains what you want to change, override it with your own custom behavior, and put it back in. We stepped through that code because if you know what the main methods of the ModelViewSet do and how they work, you know where to go when you want to tweak the behavior of your viewset. If you came here from Part 1 of What You Should Know About Django REST Framework, you may be wondering why I just walked you through a bunch of source code. Here are the slides and the video if you want to see them. I gave this talk at Påascades 2021 and decided to turn it into a series of blog posts so it's available to folks who didn't attend the conference or don't like to watch videos. Read Part 1: ModelViewSet attributes and methods and Part 3: Adding custom endpoints. This is Part 2 of a 3-part series on Django REST Framework viewsets.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |