Exemplo n.º 1
0
 def put(self,
         request,
         slug_project,
         database_object_project,
         use_sandbox,
         format=None):
     serializer = Serializer_Project(database_object_project,
                                     data=request.data,
                                     partial=True)
     if serializer.is_valid():
         serializer.save()
         return Response(serializer.data)
     return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST)
Exemplo n.º 2
0
 def get(self, request, slug_project, database_object_project, use_sandbox, format=None):
     project = Manager_Projects.get(database_object_project)
     serializer = Serializer_Project(
         project,
     )
     # serializer = Serializer_Project(database_object_project, 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)

        queryset_projects = Manager_Projects.get_all()

        serializer = Serializer_Project(queryset_projects,
                                        many=True,
                                        context={
                                            'request': request,
                                        })
        return Response(serializer.data)
Exemplo n.º 4
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)
Exemplo n.º 5
0
 def post(self, request, format=None):
     serializer = Serializer_Project(data=request.data)
     if serializer.is_valid():
         serializer.save()
         return Response(serializer.data, status=status.HTTP_201_CREATED)
     return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST)