base_name argument not specified, and could not automatically determine the name from the viewset, as it does not have a .queryset attribute
Solution 1:
In the latest DRF, you need to explicitly set base_name
in your viewset url if you don't have queryset
defined.
So, something like this should do good:
router.register(r'my-model/', MyModelView, basename='MyModel')
See this: docs Hope it helps.
Solution 2:
You must add an argument called basename
for the register method in the url.py file, Like the following code in url.py :
"In url.py"
...
from rest_framework import routers
router = routers.DefaultRouter()
router.register(r'my-model/' , MyModelView , basename='MyModel')
urlpattern=[...]
Solution 3:
You need to set basename
attribute in your url conf. Docs here