Exemplo n.º 1
0
    def handle(self, *args, **options):
        use_sandbox = options['use_sandbox']
        project_name = options['project']

        queryset = Manager_Projects.get_all()

        if project_name is not None:
            queryset = queryset.filter(name=project_name)

        for project in queryset:

            self.stdout.write(
                self.style.SUCCESS('Syncing project {} with {} HITs'.format(
                    project.name,
                    HIT.objects.filter(batch__project=project).count())))
            Manager_Batches.sync_mturk(project, use_sandbox)
Exemplo n.º 2
0
    def get(self, request, format=None):
        # list_projects = [
        #     # 'real-money-web-page-segmentation-01',
        #     # 'real-money-web-page-segmentation-02',
        #     # 'real-money-web-page-segmentation-02-rest',
        #     # 'real-money-web-page-segmentation-03',
        # ]
        #
        # for name_project in list_projects:
        #     migrate_project(name_project)

        queryset_projects = Manager_Projects.get_all()

        serializer = Serializer_Project(queryset_projects,
                                        many=True,
                                        context={
                                            'request': request,
                                        })
        return Response(serializer.data)
Exemplo n.º 3
0
    def get(self, request, format=None):
        # list_projects = [
        #     # 'real-money-web-page-segmentation-01',
        #     # 'real-money-web-page-segmentation-02',
        #     # 'real-money-web-page-segmentation-02-rest',
        #     # 'real-money-web-page-segmentation-03',
        # ]
        #
        # for name_project in list_projects:
        #     migrate_project(name_project)
        list_fields = request.query_params.getlist('fields[]')
        if len(list_fields) == 0:
            list_fields = None

        queryset_projects = Manager_Projects.get_all(fields=list_fields)

        serializer = Serializer_Project(
            queryset_projects,
            many=True,
            context={
                'request': request,
                'fields': list_fields,
            })
        return Response(serializer.data)