Skip to content

Commit ca2a1c6

Browse files
committed
Rename class to UpdateMixin and improve its docstring
1 parent 61dc78b commit ca2a1c6

File tree

2 files changed

+5
-9
lines changed

2 files changed

+5
-9
lines changed

readthedocs/api/v3/mixins.py

+2-6
Original file line numberDiff line numberDiff line change
@@ -102,13 +102,9 @@ def get_queryset(self):
102102
return self.listing_objects(queryset, self.request.user)
103103

104104

105-
class UpdatePartialUpdateMixin:
105+
class UpdateMixin:
106106

107-
"""
108-
Make PUT/PATCH behaves in the same way.
109-
110-
Force to return 204 if the update was good.
111-
"""
107+
"""Make PUT to return 204 on success like PATCH does."""
112108

113109
def update(self, request, *args, **kwargs):
114110
# NOTE: ``Authorization:`` header is mandatory to use this method from

readthedocs/api/v3/views.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727

2828

2929
from .filters import BuildFilter, ProjectFilter, VersionFilter
30-
from .mixins import ProjectQuerySetMixin, UpdatePartialUpdateMixin
30+
from .mixins import ProjectQuerySetMixin, UpdateMixin
3131
from .permissions import PublicDetailPrivateListing, IsProjectAdmin
3232
from .renderers import AlphabeticalSortedJSONRenderer
3333
from .serializers import (
@@ -74,7 +74,7 @@ class APIv3Settings:
7474

7575
class ProjectsViewSet(APIv3Settings, NestedViewSetMixin, ProjectQuerySetMixin,
7676
FlexFieldsMixin, ProjectImportMixin, CreateModelMixin,
77-
UpdatePartialUpdateMixin, UpdateModelMixin,
77+
UpdateMixin, UpdateModelMixin,
7878
ReadOnlyModelViewSet):
7979

8080
# Markdown docstring is automatically rendered by BrowsableAPIRenderer.
@@ -276,7 +276,7 @@ class TranslationRelationshipViewSet(APIv3Settings, NestedViewSetMixin,
276276
# of ``ProjectQuerySetMixin`` to make calling ``super().get_queryset()`` work
277277
# properly and filter nested dependencies
278278
class VersionsViewSet(APIv3Settings, NestedViewSetMixin, ProjectQuerySetMixin,
279-
FlexFieldsMixin, UpdatePartialUpdateMixin,
279+
FlexFieldsMixin, UpdateMixin,
280280
UpdateModelMixin, ReadOnlyModelViewSet):
281281

282282
model = Version

0 commit comments

Comments
 (0)