-
Notifications
You must be signed in to change notification settings - Fork 301
remove disallowed PUT method. #643
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
No, the merge was OK. Somehow replacing DJA's ModelViewSet is causing this error here:
leading to this failure:
I'll take a deeper dive into DRF vs DJA ModelViewSet. |
@Anton-Shutik: the problem is caused by the combination of diff --git a/example/views.py b/example/views.py
index eda29f8..7ebf9a8 100644
--- a/example/views.py
+++ b/example/views.py
@@ -12,7 +12,8 @@ from rest_framework_json_api.django_filters import DjangoFilterBackend
from rest_framework_json_api.filters import OrderingFilter, QueryParameterValidationFilter
from rest_framework_json_api.pagination import JsonApiPageNumberPagination
from rest_framework_json_api.utils import format_drf_errors
-from rest_framework_json_api.views import ModelViewSet, PreloadIncludesMixin, RelationshipView
+from rest_framework_json_api.views import ModelViewSet, PreloadIncludesMixin, RelationshipView, AutoPreloadMixin, \
+ RelatedMixin
from example.models import Author, Blog, Comment, Company, Entry, Project, ProjectType
from example.serializers import (
@@ -200,7 +201,16 @@ class CommentViewSet(ModelViewSet):
return super(CommentViewSet, self).get_queryset()
-class CompanyViewset(PreloadIncludesMixin, viewsets.ModelViewSet):
+class TestModelViewSet(
+ # AutoPreloadMixin,
+ PreloadIncludesMixin,
+ RelatedMixin,
+ viewsets.ModelViewSet):
+ http_method_names = ['get', 'post', 'patch', 'delete', 'head', 'options']
+
+
+# class CompanyViewset(PreloadIncludesMixin, viewsets.ModelViewSet):
+class CompanyViewset(TestModelViewSet):
queryset = Company.objects.all()
serializer_class = CompanySerializer
prefetch_for_includes = { |
1212c36
to
8316af2
Compare
6804b57
to
70f9b41
Compare
No clue why codecov is not updating, happens to all PRs. Merging this now and need to observe whether this might get fixed automatically. |
…-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)
…-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)
…-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)
…-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)
Fixes #614
Description of the Change
This removes the PUT method which is not specified in the JSONAPI specification. Rather, PATCH
is used for updates. PUT and PATCH were both implemented as a PATCH which is incorrect as a PUT is expected to be a complete replacement while PATCH is a partial replacement.
POTENTIAL BREAKING CHANGE: There were tests and documentation that used
put
that should have usedpatch
and it is possible that clients may be using PUT.The most visible outcome of removing PUT is that forthcoming DRF 3.10
generateschema
would incorrectly add theput
method to the openapi schema doc.Checklist
CHANGELOG.md
updated (only for user relevant changes)AUTHORS