mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-11-25 22:22:26 +00:00
Add dormitory to the building serialiser
This commit is contained in:
parent
a3909e090d
commit
d124203273
3 changed files with 16 additions and 2 deletions
|
@ -115,8 +115,14 @@ class BuildingSerializer(NamespacedHMSerializer):
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = topologie.Building
|
model = topologie.Building
|
||||||
fields = ("name", "api_url")
|
fields = ("name", "dormitory", "api_url")
|
||||||
|
|
||||||
|
class DormitorySerializer(NamespacedHMSerializer):
|
||||||
|
"""Serialize `topologie.models.Dormitory` objects
|
||||||
|
"""
|
||||||
|
class Meta:
|
||||||
|
model = topologie.Dormitory
|
||||||
|
fields = ("name", "api_url")
|
||||||
|
|
||||||
class SwitchPortSerializer(NamespacedHMSerializer):
|
class SwitchPortSerializer(NamespacedHMSerializer):
|
||||||
"""Serialize `topologie.models.Port` objects
|
"""Serialize `topologie.models.Port` objects
|
||||||
|
|
|
@ -30,6 +30,7 @@ urls_viewset = [
|
||||||
(r"topologie/constructorswitch", views.ConstructorSwitchViewSet, None),
|
(r"topologie/constructorswitch", views.ConstructorSwitchViewSet, None),
|
||||||
(r"topologie/switchbay", views.SwitchBayViewSet, None),
|
(r"topologie/switchbay", views.SwitchBayViewSet, None),
|
||||||
(r"topologie/building", views.BuildingViewSet, None),
|
(r"topologie/building", views.BuildingViewSet, None),
|
||||||
|
(r"topologie/dormitory", views.DormitoryViewSet, None),
|
||||||
(r"topologie/switchport", views.SwitchPortViewSet, "switchport"),
|
(r"topologie/switchport", views.SwitchPortViewSet, "switchport"),
|
||||||
(r"topologie/portprofile", views.PortProfileViewSet, "portprofile"),
|
(r"topologie/portprofile", views.PortProfileViewSet, "portprofile"),
|
||||||
(r"topologie/room", views.RoomViewSet, None)
|
(r"topologie/room", views.RoomViewSet, None)
|
||||||
|
|
|
@ -114,6 +114,13 @@ class RoomViewSet(viewsets.ReadOnlyModelViewSet):
|
||||||
queryset = topologie.Room.objects.all()
|
queryset = topologie.Room.objects.all()
|
||||||
serializer_class = serializers.RoomSerializer
|
serializer_class = serializers.RoomSerializer
|
||||||
|
|
||||||
|
class DormitoryViewSet(viewsets.ReadOnlyModelViewSet):
|
||||||
|
"""Exposes list and details of `topologie.models.Dormitory`
|
||||||
|
objects.
|
||||||
|
"""
|
||||||
|
|
||||||
|
queryset = topologie.Dormitory.objects.all()
|
||||||
|
serializer_class = serializers.DormitorySerializer
|
||||||
|
|
||||||
class PortProfileViewSet(viewsets.ReadOnlyModelViewSet):
|
class PortProfileViewSet(viewsets.ReadOnlyModelViewSet):
|
||||||
"""Exposes list and details of `topologie.models.PortProfile` objects.
|
"""Exposes list and details of `topologie.models.PortProfile` objects.
|
||||||
|
|
Loading…
Reference in a new issue