Add license headers
[pharos.git] / tools / pharos-dashboard / api / serializers.py
1 ##############################################################################
2 # Copyright (c) 2016 Max Breitenfeldt and others.
3 #
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 ##############################################################################
9
10
11 from rest_framework import serializers
12
13 from booking.models import Booking
14 from dashboard.models import Server, Resource
15
16
17 class BookingSerializer(serializers.HyperlinkedModelSerializer):
18     class Meta:
19         model = Booking
20         fields = ('id', 'resource', 'start', 'end', 'purpose')
21
22
23 class ServerSerializer(serializers.HyperlinkedModelSerializer):
24     class Meta:
25         model = Server
26         fields = ('id', 'resource', 'name', 'model', 'cpu', 'ram', 'storage')
27
28
29 class ResourceSerializer(serializers.HyperlinkedModelSerializer):
30     class Meta:
31         model = Resource
32         fields = ('id', 'name', 'description', 'url', 'server_set')