Browse Source

Move download view

pull/1310/head
Hironsan 3 years ago
parent
commit
25de2a6e3c
3 changed files with 16 additions and 5 deletions
  1. 10
      app/api/urls.py
  2. 1
      app/api/views/__init__.py
  3. 10
      app/api/views/export_dataset.py

10
app/api/urls.py

@ -13,6 +13,16 @@ urlpatterns_project = [
view=views.upload.view.DatasetCatalog.as_view(), view=views.upload.view.DatasetCatalog.as_view(),
name='catalog' name='catalog'
), ),
path(
route='download-format',
view=views.DownloadDatasetCatalog.as_view(),
name='download-format'
),
path(
route='export',
view=views.DownloadAPI.as_view(),
name='export-dataset'
),
path( path(
route='statistics', route='statistics',
view=views.StatisticsAPI.as_view(), view=views.StatisticsAPI.as_view(),

1
app/api/views/__init__.py

@ -2,6 +2,7 @@ from .annotation import *
from .auto_labeling import * from .auto_labeling import *
from .comment import * from .comment import *
from .document import * from .document import *
from .export_dataset import *
from .health import * from .health import *
from .import_export import * from .import_export import *
from .label import * from .label import *

app/api/views/download/view.py → app/api/views/export_dataset.py

@ -6,13 +6,13 @@ from rest_framework.permissions import IsAuthenticated
from rest_framework.response import Response from rest_framework.response import Response
from rest_framework.views import APIView from rest_framework.views import APIView
from ...models import Project
from ...permissions import IsProjectAdmin
from ...tasks import export_dataset
from .catalog import Options
from ..models import Project
from ..permissions import IsProjectAdmin
from ..tasks import export_dataset
from .download.catalog import Options
class DatasetCatalog(APIView):
class DownloadDatasetCatalog(APIView):
permission_classes = [IsAuthenticated & IsProjectAdmin] permission_classes = [IsAuthenticated & IsProjectAdmin]
def get(self, request, *args, **kwargs): def get(self, request, *args, **kwargs):
Loading…
Cancel
Save