mirror of https://github.com/jumpserver/jumpserver
parent
664bc2a4d9
commit
e719904874
|
@ -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…
Reference in New Issue