12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- from django.views.decorators.http import require_POST
- from pycs_api.views.base import JsonResponseView
- from rest_framework.decorators import permission_classes
- class ProjectView(JsonResponseView):
- """
- serves POST and GET for '/projects/'
- staticmethods serve POST methods for
- '/projects/<id>/name'
- '/projects/<id>/description'
- '/projects/<id>/remove'
- """
- http_method_names = ["get", "post"]
- def get(self, request, *args, **kwargs):
- """ lists projects """
- return self.respond([
- dict(name="Project 1", description="Desc1", ),
- dict(name="Project 2", description="Desc2"),
- ])
- def post(self, request, *args, **kwargs):
- """ creates a project """
- return self.respond()
- @require_POST
- @classmethod
- def remove(cls, request, project_id: int):
- """ removes a project """
- return cls.respond()
- @require_POST
- @classmethod
- def edit_name(cls, request, project_id: int):
- """ edit project's name """
- return cls.respond()
- @require_POST
- @classmethod
- def edit_description(cls, request, project_id: int):
- """ edit project's description """
- return cls.respond()
- @require_POST
- @classmethod
- def run_external_storage(cls, request, project_id: int):
- """ runs external storage routine """
- return cls.respond()
- @require_POST
- @classmethod
- def run_label_provider(cls, request, project_id: int):
- """ runs label provider routine """
- return cls.respond()
|