Skip to content

Commit 919fece

Browse files
committed
Allow POST, PATCH, DELETE for actions in ReadOnlyModelViewSet (django-json-api#797)
Currently if you try to use `POST` for action in `ReadOnlyModelViewSet` you will get problems: - with DRF UI you will loose data input forms - `drf_yasg` package will not generate OpenAPI specifications for such actions This behavior was added to `django-rest-framework-json-api` in version 2.8.0 by mistake: Commit: 7abd764 Subject: remove disallowed PUT method. (django-json-api#643)
1 parent 073c45b commit 919fece

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

rest_framework_json_api/views.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ class ModelViewSet(AutoPrefetchMixin,
210210
class ReadOnlyModelViewSet(AutoPrefetchMixin,
211211
RelatedMixin,
212212
viewsets.ReadOnlyModelViewSet):
213-
http_method_names = ['get', 'head', 'options']
213+
http_method_names = ['get', 'post', 'patch', 'delete', 'head', 'options']
214214

215215

216216
class RelationshipView(generics.GenericAPIView):

0 commit comments

Comments
 (0)