← Backend PythonQuestion 47 of 49
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
- 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?
- When is annotate() guaranteed to generate a GROUP BY in Django ORM?
- Examples of Python stdlib modules runnable as scripts (python -m ...):
- How can you prevent race conditions in a Django application?
← PreviousNo login needed