|
You are here |
www.django-rest-framework.org | ||
| | | | |
stribny.name
|
|
| | | | | How to combine request and response serializers into one for use in ModelViewSets. | |
| | | | |
sam.hooke.me
|
|
| | | | | The home page of Sam Hooke. | |
| | | | |
corgibytes.com
|
|
| | | | | I've spent the last couple of months working on an API written using Python, Django, and Django REST Framework (DRF). The latter is a popular, well-established framework for building APIs in Python, so I assumed it would have decent documentation surrounding relational fields, which is a fairly common situation in any model-view-controller (MVC) framework. It turns out that was a faulty assumption. | |
| | | | |
www.laceyhenschel.com
|
|
| | | 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... | ||