Пример #1
0
    def get(self,
            request,
            slug_project,
            database_object_project,
            use_sandbox,
            format=None):
        queryset, list_fields = Manager_Templates_Worker.get_all(
            database_object_project=database_object_project,
            request=request,
        )

        queryset_paginated, count_items = paginate_queryset(queryset, request)

        serializer = Serializer_Template_Worker(queryset_paginated,
                                                many=True,
                                                context={
                                                    'request': request,
                                                    'usecase':
                                                    'list_templates_worker',
                                                    'fields': list_fields,
                                                })

        return Response({
            'items_total': count_items,
            'data': serializer.data,
        })
Пример #2
0
def templates_worker_all(request,
                         slug_project,
                         database_object_project,
                         use_sandbox,
                         format=None):
    queryset, list_fields = Manager_Templates_Worker.get_all(
        database_object_project=database_object_project,
        request=request,
    )

    serializer = Serializer_Template_Worker(queryset,
                                            many=True,
                                            context={
                                                'usecase':
                                                'templates_worker_all',
                                                'fields': list_fields,
                                            })

    return Response(serializer.data)
Пример #3
0
def templates_worker_all(request, slug_project, database_object_project, use_sandbox, format=None):
    list_fields = request.query_params.getlist('fields[]')
    if len(list_fields) == 0:
        list_fields = None

    queryset = Manager_Templates_Worker.get_all(
        database_object_project=database_object_project,
        request=request,
        fields=list_fields,
    )

    serializer = Serializer_Template_Worker(
        queryset,
        many=True,
        context={
            'usecase': 'templates_worker_all',
            'fields': list_fields,
        }
    )

    return Response(serializer.data)