Commit a965fc13 authored by Daniel W Bond's avatar Daniel W Bond
Browse files

I still don't really have a good way of listing floors of buildings or rooms on floors

parent fc5ec423
......@@ -11,6 +11,13 @@ from accounts.models import Major
class BuildingSerializer(serializers.ModelSerializer):
floors = serializers.SerializerMethodField('get_building_floors')
def get_building_floors(self, building):
floors = serialize('json', Floor.objects.filter(building=building),
fields=('number'))
return floors
class Meta:
model = Building
fields = ('name', 'neighbourhood', 'campus')
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment