Explore >> Select a destination


You are here

sam.hooke.me
| | www.cdrf.co
1.1 parsecs away

Travel
| | Detailed descriptions, with full methods and attributes of ModelViewSet Django REST Framework class.
| | www.laceyhenschel.com
2.1 parsecs away

Travel
| | 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. 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. 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. In Part 1, we were writing a BookViewSet. So let's go through a few cases where we might want to customize the behavior of our endpoints and walk through how we would do that.
| | www.django-rest-framework.org
1.8 parsecs away

Travel
| | Django, API, REST, Serializers
| | www.laceyhenschel.com
4.8 parsecs away

Travel
| Sometimes the endpoints you get when you use a ModelViewSet aren't enough and you need to add extra endpoints for custom functions. To do this, you could use the APIView class and add a custom route to your `urls.py` file, and that would work fine. But if you have a viewset already, and you feel like this new endpoint belongs with the other endpoints in your viewset, you can use DRF's @action decorator to add a custom endpoint. This means you don't have to change your urls.py -- the method you decorate w...