Django DB Rest is a library that integrate Django Rest Framework to Django Model
Add "django-db-rest" to your INSTALLED_APPS setting like this:
INSTALLED_APPS = [ ... 'django-db-rest', ]
Make your viewset extends from ModelViewSet imported from django-db-rest/viewsets package:
class MyViewSet(ModelViewSet),
Add
model_class
property to your viewsets class.If your model is one to many, add
detail_model_class
andfkey_detail
.detail_model_class
is your many model whilefkey_detail
is foreign key name of your parent modelMakesure that you have django and djangorestframework package installed