Exemple #1
0
    def get(self, request):
        """
        get:
        Project state

        Retrieve the project state for data manager.
        """
        pk = int_from_request(request.GET, "project",
                              1)  # replace 1 to None, it's for debug only
        project = get_object_with_check_and_log(request,
                                                Project.objects.with_counts(),
                                                pk=pk)
        self.check_object_permissions(request, project)
        data = ProjectSerializer(project).data
        data.update({
            "can_delete_tasks":
            True,
            "can_manage_annotations":
            True,
            "can_manage_tasks":
            True,
            "source_syncing":
            False,
            "target_syncing":
            False,
            "task_count":
            project.tasks.count(),
            "annotation_count":
            Annotation.objects.filter(task__project=project).count(),
            'config_has_control_tags':
            len(project.get_control_tags_from_config()) > 0
        })
        return Response(data)