Commit 2f344d63 authored by lukas.burgey's avatar lukas.burgey

Add UserPreferencesView

parent fa515558
......@@ -12,7 +12,8 @@ from feudal.backend.views.renderers import PlainTextRenderer
from feudal.backend.models import Service
from feudal.backend.models.serializers import (
UserStateSerializer, ServiceSerializer, SSHPublicKeySerializer,
DeploymentSerializer, DeploymentStateSerializer
DeploymentSerializer, DeploymentStateSerializer,
UserPreferencesSerializer
)
from feudal.backend.models.deployments import VODeployment, ServiceDeployment
from feudal.backend.models.auth.vos import VO
......@@ -83,6 +84,21 @@ class UserView(generics.RetrieveDestroyAPIView):
instance.delete()
class UserPreferencesView(generics.RetrieveUpdateAPIView):
permission_classes = PERMISSION_CLASSES
serializer_class = UserPreferencesSerializer
def get_object(self):
return self.request.user.preferences
def perform_update(self, serializer):
serializer.save()
LOGGER.debug(self.request.user.msg('Updated preferences'))
class ServiceListView(generics.ListAPIView):
permission_classes = PERMISSION_CLASSES
serializer_class = ServiceSerializer
......@@ -265,6 +281,8 @@ class DeploymentStateView(generics.RetrieveUpdateAPIView):
URLPATTERNS = [
path('user', UserView.as_view(), name='user'),
path('user-prefs', UserPreferencesView.as_view(), name='user-prefs'),
path('services', ServiceListView.as_view(), name='user-services'),
re_path(r'^service/(?P<id>[0-9]+)$', ServiceView.as_view(), name='user-service'),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment