1 ##############################################################################
2 # Copyright (c) 2016 Max Breitenfeldt and others.
4 # All rights reserved. This program and the accompanying materials
5 # are made available under the terms of the Apache License, Version 2.0
6 # which accompanies this distribution, and is available at
7 # http://www.apache.org/licenses/LICENSE-2.0
8 ##############################################################################
11 from rest_framework import viewsets
13 from api.serializers import ResourceSerializer, ServerSerializer, BookingSerializer
14 from booking.models import Booking
15 from dashboard.models import Resource, Server
18 class BookingViewSet(viewsets.ModelViewSet):
19 queryset = Booking.objects.all()
20 serializer_class = BookingSerializer
21 filter_fields = ('resource', 'user')
24 class ServerViewSet(viewsets.ModelViewSet):
25 queryset = Server.objects.all()
26 serializer_class = ServerSerializer
27 filter_fields = ('resource', 'name')
30 class ResourceViewSet(viewsets.ModelViewSet):
31 queryset = Resource.objects.all()
32 serializer_class = ResourceSerializer
33 filter_fields = ('name',)