mirror of https://github.com/jumpserver/jumpserver
parent
40bd197581
commit
419381bd10
|
@ -3,13 +3,13 @@
|
||||||
from rest_framework import status, viewsets
|
from rest_framework import status, viewsets
|
||||||
from rest_framework.response import Response
|
from rest_framework.response import Response
|
||||||
|
|
||||||
from orgs.mixins.api import OrgBulkModelViewSet
|
|
||||||
from common.const.choices import Trigger
|
|
||||||
from accounts import serializers
|
from accounts import serializers
|
||||||
from accounts.tasks import execute_account_backup_plan
|
|
||||||
from accounts.models import (
|
from accounts.models import (
|
||||||
AccountBackupAutomation, AccountBackupExecution
|
AccountBackupAutomation, AccountBackupExecution
|
||||||
)
|
)
|
||||||
|
from accounts.tasks import execute_account_backup_plan
|
||||||
|
from common.const.choices import Trigger
|
||||||
|
from orgs.mixins.api import OrgBulkModelViewSet
|
||||||
|
|
||||||
__all__ = [
|
__all__ = [
|
||||||
'AccountBackupPlanViewSet', 'AccountBackupPlanExecutionViewSet'
|
'AccountBackupPlanViewSet', 'AccountBackupPlanExecutionViewSet'
|
||||||
|
@ -39,5 +39,5 @@ class AccountBackupPlanExecutionViewSet(viewsets.ModelViewSet):
|
||||||
serializer = self.get_serializer(data=request.data)
|
serializer = self.get_serializer(data=request.data)
|
||||||
serializer.is_valid(raise_exception=True)
|
serializer.is_valid(raise_exception=True)
|
||||||
pid = serializer.data.get('plan')
|
pid = serializer.data.get('plan')
|
||||||
task = execute_account_backup_plan.delay(pid=pid, trigger=Trigger.manual)
|
task = execute_account_backup_plan.delay(pid=str(pid), trigger=Trigger.manual)
|
||||||
return Response({'task': task.id}, status=status.HTTP_201_CREATED)
|
return Response({'task': task.id}, status=status.HTTP_201_CREATED)
|
||||||
|
|
Loading…
Reference in New Issue