[Patchew-devel] [PATCH] rest: use @action instead of @detail_route

Paolo Bonzini posted 1 patch 72 weeks ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/patchew next tags/patchew/20190506153156.25069-1-pbonzini@redhat.com
api/rest.py | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

[Patchew-devel] [PATCH] rest: use @action instead of @detail_route

Posted by Paolo Bonzini 72 weeks ago
The detail_route decorator is deprecated and will be removed in 3.10 in favor of
"`action`, which accepts a `detail` bool. Use `@action(detail=True)` instead.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
 api/rest.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/api/rest.py b/api/rest.py
index 041e82d..4d08e16 100644
--- a/api/rest.py
+++ b/api/rest.py
@@ -18,7 +18,7 @@ from .models import Project, ProjectResult, Message, MessageResult, Result
 from .search import SearchEngine
 from rest_framework import (permissions, serializers, viewsets, filters,
                             mixins, renderers, status)
-from rest_framework.decorators import detail_route, action
+from rest_framework.decorators import action
 from rest_framework.fields import SerializerMethodField, CharField, JSONField, EmailField, ListField
 from rest_framework.relations import HyperlinkedIdentityField
 from rest_framework.response import Response
@@ -484,12 +484,12 @@ class ProjectMessagesViewSet(ProjectMessagesViewSetMixin,
     serializer_class = MessageSerializer
     parser_classes = (JSONParser, MessagePlainTextParser, )
-    @detail_route(renderer_classes=[StaticTextRenderer])
+    @action(detail=True, renderer_classes=[StaticTextRenderer])
     def mbox(self, request, *args, **kwargs):
         message = self.get_object()
         return Response(message.get_mbox())
-    @detail_route()
+    @action(detail=True)
     def replies(self, request, *args, **kwargs):
         message = self.get_object()
         replies = Message.objects.filter(in_reply_to=message.message_id,

Patchew-devel mailing list