From 5cc2fdae4f081b5c864d8bcca8945e9eb4c0be5f Mon Sep 17 00:00:00 2001 From: fit2bot <68588906+fit2bot@users.noreply.github.com> Date: Mon, 21 Mar 2022 11:14:49 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8Dapi=20docs=E6=89=93?= =?UTF-8?q?=E4=B8=8D=E5=BC=80=E7=9A=84=E9=97=AE=E9=A2=98=20(#7938)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Jiangjie.Bai <bugatti_it@163.com> --- apps/tickets/api/comment.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/apps/tickets/api/comment.py b/apps/tickets/api/comment.py index ab0584eed..1515f7c9b 100644 --- a/apps/tickets/api/comment.py +++ b/apps/tickets/api/comment.py @@ -6,7 +6,7 @@ from common.exceptions import JMSException from common.utils import lazyproperty from rbac.permissions import RBACPermission from tickets import serializers -from tickets.models import Ticket +from tickets.models import Ticket, Comment from tickets.permissions.comment import IsAssignee, IsApplicant, IsSwagger @@ -36,5 +36,7 @@ class CommentViewSet(mixins.CreateModelMixin, viewsets.ReadOnlyModelViewSet): return context def get_queryset(self): + if getattr(self, 'swagger_fake_view', False): + return Comment.objects.none() queryset = self.ticket.comments.all() return queryset