I Have just started with django-rest-framework. Pretty enthousiastic about it, except for the fact there are very little examples available. getting the api working is going
If you are using ModelViewSet and still want to restrict some methods you can add http_method_names
.
Example:
class SomeModelViewSet(viewsets.ModelViewSet):
queryset = SomeModel.objects.all()
serializer_class = SomeModelSerializer
http_method_names = ['get', 'post', 'head']
Once you do this, get
, post
and head
will be allowed. But put
, patch
and delete
will not be allowed.