I recently started using DRF and am wondering how to get the automatically generated API Root provided by a Router to display endpoint routes that don't come from ViewSet-based views.
In my case, I have some non-ViewSet (generic) class-based views (ListAPIView and RetrieveAPIView) in my views.py that I would like to appear in my API Root.
I am open to alternative solutions to this, e.g. should I abandon ViewSets and implement those endpoints differently, etc.
I think the best way here is to:
APIRoot
-View (it is not that complex, see the source).DefaultRouter
to make DRF use your APIRoot-View. If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With