def create(self, **kwargs):
     comment_data = self.validated_data.pop('comment')
     comment_serializer = CommentSerializer(data=comment_data)
     if comment_serializer.is_valid():
         comment = comment_serializer.create(sender=kwargs['sender'])
         project_comment = models.ProjectComment.objects.create(project_id=kwargs['project'], comment_id=comment.id)
         return {'id': project_comment.id, 'comment': comment}
예제 #2
0
 def create(self, **kwargs):
     comment_data = self.validated_data.pop('comment')
     comment_serializer = CommentSerializer(data=comment_data)
     if comment_serializer.is_valid():
         comment = comment_serializer.create(sender=kwargs['sender'])
         project_comment = models.ProjectComment.objects.create(project_id=kwargs['project'], comment_id=comment.id)
         return {'id': project_comment.id, 'comment': comment}
예제 #3
0
 def create(self, **kwargs):
     comment_data = self.validated_data.pop('comment')
     comment_serializer = CommentSerializer(data=comment_data)
     if comment_serializer.is_valid():
         comment = comment_serializer.create(sender=kwargs['sender'])
         task_comment = models.TaskComment.objects.create(task_id=kwargs['task'], comment_id=comment.id)
         return {'id': task_comment.id, 'comment': comment}
예제 #4
0
 def create(self, **kwargs):
     comment_data = self.validated_data.pop("comment")
     comment_serializer = CommentSerializer(data=comment_data)
     if comment_serializer.is_valid():
         comment = comment_serializer.create(sender=kwargs["sender"])
         task_comment = models.TaskComment.objects.create(task_id=kwargs["task"], comment_id=comment.id)
         return {"id": task_comment.id, "comment": comment}
예제 #5
0
 def create(self, **kwargs):
     comment_data = self.validated_data.pop('comment')
     comment_serializer = CommentSerializer(data=comment_data)
     if comment_serializer.is_valid():
         comment = comment_serializer.create(sender=kwargs['sender'])
         module_comment = models.ModuleComment.objects.create(module_id=kwargs['module'], comment_id=comment.id)
         return {'id': module_comment.id, 'comment': comment}
예제 #6
0
 def create(self, **kwargs):
     comment_data = self.validated_data.pop("comment")
     comment_serializer = CommentSerializer(data=comment_data)
     if comment_serializer.is_valid():
         comment = comment_serializer.create(sender=kwargs["sender"])
         project_comment = models.ProjectComment.objects.create(project_id=kwargs["project"], comment_id=comment.id)
         return {"id": project_comment.id, "comment": comment}
예제 #7
0
 def create(self, **kwargs):
     comment_data = self.validated_data.pop('comment')
     comment_serializer = CommentSerializer(data=comment_data)
     if comment_serializer.is_valid():
         comment = comment_serializer.create(sender=kwargs['sender'])
         module_comment = models.ModuleComment.objects.create(
             module_id=kwargs['module'], comment_id=comment.id)
         return {'id': module_comment.id, 'comment': comment}
예제 #8
0
class TaskCommentSerializer(DynamicFieldsModelSerializer):
    comment = CommentSerializer()

    class Meta:
        model = models.TaskComment
        fields = ('id', 'task', 'comment')
        read_only_fields = ('task',)

    def create(self, **kwargs):
        comment_data = self.validated_data.pop('comment')
        comment_serializer = CommentSerializer(data=comment_data)
        if comment_serializer.is_valid():
            comment = comment_serializer.create(sender=kwargs['sender'])
            task_comment = models.TaskComment.objects.create(task_id=kwargs['task'], comment_id=comment.id)
            return {'id': task_comment.id, 'comment': comment}
예제 #9
0
파일: project.py 프로젝트: 9vinny/hcc-daemo
class ProjectCommentSerializer(DynamicFieldsModelSerializer):
    comment = CommentSerializer(fields=('id', 'body', 'sender_alias'))

    class Meta:
        model = models.ProjectComment
        fields = ('id', 'project', 'comment', 'ready_for_launch')
        read_only_fields = ('project', )

    def create(self, **kwargs):
        comment_data = self.validated_data.pop('comment')
        comment_serializer = CommentSerializer(data=comment_data)
        if comment_serializer.is_valid():
            comment = comment_serializer.create(sender=kwargs['sender'])
            project_comment = models.ProjectComment.objects.create(
                project_id=kwargs['project'],
                comment_id=comment.id,
                ready_for_launch=kwargs['ready_for_launch'])
            return {'id': project_comment.id, 'comment': comment}