[Fixed]-Django. ''The `actions` argument must be provided when calling `.as_view()` '' when I try to allow DELETE, PUT, ETC

29👍

You don’t use as_view when registering a ViewSet:

from cutarea.views import *
#...
from rest_framework import routers
router = routers.DefaultRouter()
router.register(r'cutarea', DualFcaPlanUseViewSet, basename='cutareadel')
#...

urlpatterns = [
    #...
    url(r'^api/', include(router.urls)),
]

Edit: using basename instead of base_name thanks to @greg-schmit for pointing it.

2👍

You must add {‘get’: ‘list’} to

router.register(r'cutarea', DualFcaPlanUseViewSet.as_view(), base_name='cutareadel')

router.register(r'cutarea', DualFcaPlanUseViewSet.as_view({'get': 'list'}), base_name='cutareadel')

Leave a comment