I´m building an API with DRF, and I’m wondering if its enough to use the only the ModelViewSet class to to implement the CRUD. My worries is that it’s not enough for the frontend to consume and use the create, read, update and delete functionalities.
I presume you mean to ask if ModelViewSet
is sufficient in addition with a simple serializer? In that case I’d argue that yes, this should cover most of your use cases, unless your models do something crazy in regards to how they are linked. We have a project where the API is 95% CRUD and is used by the frontend and all we needed was extending on ModelViewSet
and HyperlinkedModelSerializer
.
However in all likelyhood you will also encounter a use case where custom endpoints are required, so expect to write one or two of those.
Thanks a lot for your help!