summaryrefslogtreecommitdiffstats
path: root/pharos-dashboard/src/api/views.py
diff options
context:
space:
mode:
authormaxbr <maxbr@mi.fu-berlin.de>2017-01-05 12:34:37 +0100
committermaxbr <maxbr@mi.fu-berlin.de>2017-01-05 12:34:37 +0100
commit0f779323898999cc6269ee2f9183de75e1eedab0 (patch)
tree8b99d6b287224611886e5b9de1956172f3a3c627 /pharos-dashboard/src/api/views.py
parent026ae4994e15809d25bf9f62e36f6fe5b35b1542 (diff)
Add library for dashboard API
JIRA: PHAROS-265 The DashboardAPI class can be used to query and update dashboard data. Change-Id: I584a3cc500ff1d67011c18af4e73e504126310a2 Signed-off-by: maxbr <maxbr@mi.fu-berlin.de>
Diffstat (limited to 'pharos-dashboard/src/api/views.py')
-rw-r--r--pharos-dashboard/src/api/views.py12
1 files changed, 8 insertions, 4 deletions
diff --git a/pharos-dashboard/src/api/views.py b/pharos-dashboard/src/api/views.py
index 2595e5e..84fa1b5 100644
--- a/pharos-dashboard/src/api/views.py
+++ b/pharos-dashboard/src/api/views.py
@@ -15,15 +15,15 @@ from django.views import View
from rest_framework import viewsets
from rest_framework.authtoken.models import Token
-from api.serializers import ResourceSerializer, ServerSerializer, BookingSerializer
+from api.serializers import *
from booking.models import Booking
-from dashboard.models import Resource, Server
+from dashboard.models import Resource, Server, ResourceStatus
class BookingViewSet(viewsets.ModelViewSet):
queryset = Booking.objects.all()
serializer_class = BookingSerializer
- filter_fields = ('resource', 'user')
+ filter_fields = ('resource', 'id')
class ServerViewSet(viewsets.ModelViewSet):
@@ -35,7 +35,11 @@ class ServerViewSet(viewsets.ModelViewSet):
class ResourceViewSet(viewsets.ModelViewSet):
queryset = Resource.objects.all()
serializer_class = ResourceSerializer
- filter_fields = ('name',)
+ filter_fields = ('name', 'id')
+
+class ResourceStatusViewSet(viewsets.ModelViewSet):
+ queryset = ResourceStatus.objects.all()
+ serializer_class = ResourceStatusSerializer
@method_decorator(login_required, name='dispatch')