2020-11-30 17:23:35 +01:00
|
|
|
from rest_framework import viewsets
|
|
|
|
from rest_framework import permissions
|
|
|
|
|
|
|
|
from .models import BackupMethod
|
|
|
|
from .models import Backup
|
|
|
|
from .models import TargetDevice
|
|
|
|
from .models import NotificationFromBackup
|
|
|
|
from .models import Notification
|
|
|
|
from .models import NotificationType
|
|
|
|
|
|
|
|
from .serializers import BackupMethodSerializer
|
|
|
|
from .serializers import BackupSerializer
|
|
|
|
from .serializers import TargetDeviceSerializer
|
|
|
|
from .serializers import NotificationFromBackupSerializer
|
|
|
|
from .serializers import NotificationSerializer
|
|
|
|
from .serializers import NotificationTypeSerializer
|
|
|
|
|
|
|
|
|
|
|
|
class BackupMethodViewSet(viewsets.ModelViewSet):
|
|
|
|
"""
|
|
|
|
API endpoint that allows BackupMethods to be viewed or edited.
|
|
|
|
"""
|
|
|
|
queryset = BackupMethod.objects.all()
|
|
|
|
serializer_class = BackupMethodSerializer
|
|
|
|
permission_classes = [permissions.IsAuthenticated]
|
|
|
|
|
|
|
|
|
|
|
|
class BackupViewSet(viewsets.ModelViewSet):
|
|
|
|
"""
|
|
|
|
API endpoint that allows BackupMethods to be viewed or edited.
|
|
|
|
"""
|
2020-12-07 18:45:22 +01:00
|
|
|
queryset = Backup.objects.all().order_by('name')
|
2020-11-30 17:23:35 +01:00
|
|
|
serializer_class = BackupSerializer
|
|
|
|
permission_classes = [permissions.IsAuthenticated]
|
|
|
|
|
|
|
|
|
|
|
|
class TargetDeviceViewSet(viewsets.ModelViewSet):
|
|
|
|
"""
|
|
|
|
API endpoint that allows BackupMethods to be viewed or edited.
|
|
|
|
"""
|
2020-12-07 18:45:22 +01:00
|
|
|
queryset = TargetDevice.objects.all().order_by('device')
|
2020-11-30 17:23:35 +01:00
|
|
|
serializer_class = TargetDeviceSerializer
|
|
|
|
permission_classes = [permissions.IsAuthenticated]
|
|
|
|
|
|
|
|
|
|
|
|
class NotificationFromBackupViewSet(viewsets.ModelViewSet):
|
|
|
|
"""
|
|
|
|
API endpoint that allows BackupMethods to be viewed or edited.
|
|
|
|
"""
|
2020-12-07 18:45:22 +01:00
|
|
|
queryset = NotificationFromBackup.objects.all().order_by('backup')
|
2020-11-30 17:23:35 +01:00
|
|
|
serializer_class = NotificationFromBackupSerializer
|
|
|
|
permission_classes = [permissions.IsAuthenticated]
|
|
|
|
|
|
|
|
|
|
|
|
class NotificationViewSet(viewsets.ModelViewSet):
|
|
|
|
"""
|
|
|
|
API endpoint that allows BackupMethods to be viewed or edited.
|
|
|
|
"""
|
|
|
|
queryset = Notification.objects.all()
|
|
|
|
serializer_class = NotificationSerializer
|
|
|
|
permission_classes = [permissions.IsAuthenticated]
|
|
|
|
|
|
|
|
|
|
|
|
class NotificationTypeViewSet(viewsets.ModelViewSet):
|
|
|
|
"""
|
|
|
|
API endpoint that allows BackupMethods to be viewed or edited.
|
|
|
|
"""
|
2020-12-07 18:45:22 +01:00
|
|
|
queryset = NotificationType.objects.all().order_by('name')
|
2020-11-30 17:23:35 +01:00
|
|
|
serializer_class = NotificationTypeSerializer
|
|
|
|
permission_classes = [permissions.IsAuthenticated]
|