← Fullstack with Vue.jsQuestion 41 of 62
In Django REST Framework ViewSets, which decorator is used to create a custom endpoint?
📘 Explanation
DRF's @action decorator is the standard way to add custom endpoints to a ViewSet, with detail=True targeting a single object and detail=False targeting the collection. The other options invent decorators like @route, @endpoint, or misuse @api_view and parameter names that don't exist in DRF.
Related questions
- How can you restrict which queryset a DRF view uses?
- Where do the values in request.data come from in Django REST Framework?
- In DRF, how does field-level vs object-level validation work in serializers?
- What are the standard methods in a Django REST Framework ViewSet and their corresponding HTTP methods?
- What are the first steps to debug performance issues in Django?
← PreviousNo login needed