serializers.py 613 Bytes
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# standard library imports
from __future__ import absolute_import, print_function
# third party imports
from rest_framework import serializers
# imports from your apps
from housing.models import Building, Floor, Room


class BuildingSerializer(serializers.ModelSerializer):

    class Meta:
        model = Building
        fields = ('name', 'neighbourhood', 'campus')


class FloorSerializer(serializers.ModelSerializer):

    class Meta:
        model = Floor
        fields = ('number', )


class RoomSerializer(serializers.ModelSerializer):

    class Meta:
        model = Room
        fields = ('number', )