8
0
Fork 0
mirror of https://gitlab2.federez.net/re2o/re2o synced 2024-11-27 23:22:25 +00:00

Add building to the room serialiser

Add dormitory to the building serialiser

Add dormitory to the building serialiser

Add dormitory to the building serialiser

Add dormitory to the building serialiser

Add building to the room serialiser

Add dormitory to the building serialiser

Add dormitory to the building serialiser

Add dormitory to the building serialiser

Add dormitory to the building serialiser
This commit is contained in:
histausse 2020-09-01 17:20:37 +02:00
parent 89f91add15
commit 62d5139784
3 changed files with 10 additions and 2 deletions

View file

@ -117,7 +117,7 @@ class BuildingSerializer(NamespacedHMSerializer):
model = topologie.Building model = topologie.Building
fields = ("name", "dormitory", "api_url") fields = ("name", "dormitory", "api_url")
class DormitorySerializer(NamespaceHMSerializer): class DormitorySerializer(NamespacedHMSerializer):
"""Serialize `topologie.models.Dormitory` objects """Serialize `topologie.models.Dormitory` objects
""" """
class Meta: class Meta:

View file

@ -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)

View file

@ -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.Room.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.
@ -146,4 +153,4 @@ class RoleView(generics.ListAPIView):
""" """
queryset = machines.Role.objects.all().prefetch_related("servers") queryset = machines.Role.objects.all().prefetch_related("servers")
serializer_class = serializers.RoleSerializer serializer_class = serializers.RoleSerializer