diff options
Diffstat (limited to 'tools/pharos-dashboard/api/views.py')
-rw-r--r-- | tools/pharos-dashboard/api/views.py | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/tools/pharos-dashboard/api/views.py b/tools/pharos-dashboard/api/views.py new file mode 100644 index 00000000..78d7b8a9 --- /dev/null +++ b/tools/pharos-dashboard/api/views.py @@ -0,0 +1,23 @@ +from rest_framework import viewsets + +from api.serializers import ResourceSerializer, ServerSerializer, BookingSerializer +from booking.models import Booking +from dashboard.models import Resource, Server + + +class BookingViewSet(viewsets.ModelViewSet): + queryset = Booking.objects.all() + serializer_class = BookingSerializer + filter_fields = ('resource', 'user') + + +class ServerViewSet(viewsets.ModelViewSet): + queryset = Server.objects.all() + serializer_class = ServerSerializer + filter_fields = ('resource', 'name') + + +class ResourceViewSet(viewsets.ModelViewSet): + queryset = Resource.objects.all() + serializer_class = ResourceSerializer + filter_fields = ('name',)
\ No newline at end of file |