fix: 修复工单回复报500 (#11571)

Co-authored-by: feng <1304903146@qq.com>
pull/11574/head
fit2bot 1 year ago committed by GitHub
parent 664bc2a4d9
commit e719904874
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -9,7 +9,6 @@ from tickets import serializers
from tickets.models import Ticket, Comment
from tickets.permissions.comment import IsAssignee, IsApplicant, IsSwagger
__all__ = ['CommentViewSet']

@ -6,14 +6,14 @@ from ..models import Comment
__all__ = ['CommentSerializer']
class CurrentTicket(object):
ticket = None
class CurrentTicket:
requires_context = True
def set_context(self, serializer_field):
self.ticket = serializer_field.context['ticket']
def __call__(self, serializer_field):
return serializer_field.context['ticket']
def __call__(self):
return self.ticket
def __repr__(self):
return '%s()' % self.__class__.__name__
class CommentSerializer(serializers.ModelSerializer):

Loading…
Cancel
Save