diff --git a/app/core/serializers/ticket_comment.py b/app/core/serializers/ticket_comment.py index 0c6db6c97..3e335ff59 100644 --- a/app/core/serializers/ticket_comment.py +++ b/app/core/serializers/ticket_comment.py @@ -187,15 +187,6 @@ def __init__(self, instance=None, data=empty, **kwargs): self.request = kwargs['context']['request'] - if 'view' in kwargs['context']: - - if kwargs['context']['view'].action == 'create': - - - if 'request' in kwargs['context']['view'].kwargs: - - self.fields.fields['user'].initial = self.request._user.id - def validate(self, attrs): @@ -251,6 +242,8 @@ def is_valid(self, *, raise_exception=False): if self._context['view'].action == 'create': + self.validated_data['user'] = self.request._user + if 'ticket_id' in self._kwargs['context']['view'].kwargs: self.validated_data['ticket_id'] = int(self._kwargs['context']['view'].kwargs['ticket_id'])