Browse Source

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

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

1
apps/tickets/api/comment.py

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

12
apps/tickets/serializers/comment.py

@ -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