diff --git a/apps/tickets/api/comment.py b/apps/tickets/api/comment.py index e9eaf4ac3..3f66663df 100644 --- a/apps/tickets/api/comment.py +++ b/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'] diff --git a/apps/tickets/serializers/comment.py b/apps/tickets/serializers/comment.py index 09ce04232..dfee1c84f 100644 --- a/apps/tickets/serializers/comment.py +++ b/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):