mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-22 20:12:00 -06:00
Fixes #772: Fix TypeError in API RackUnitListView when no device is excluded
This commit is contained in:
parent
52567c4ade
commit
0d4b2a6e92
@ -118,11 +118,13 @@ class RackUnitListView(APIView):
|
|||||||
|
|
||||||
rack = get_object_or_404(Rack, pk=pk)
|
rack = get_object_or_404(Rack, pk=pk)
|
||||||
face = request.GET.get('face', 0)
|
face = request.GET.get('face', 0)
|
||||||
try:
|
exclude_pk = request.GET.get('exclude', None)
|
||||||
exclude = int(request.GET.get('exclude', None))
|
if exclude_pk is not None:
|
||||||
except ValueError:
|
try:
|
||||||
exclude = None
|
exclude_pk = int(exclude_pk)
|
||||||
elevation = rack.get_rack_units(face, exclude)
|
except ValueError:
|
||||||
|
exclude_pk = None
|
||||||
|
elevation = rack.get_rack_units(face, exclude_pk)
|
||||||
|
|
||||||
# Serialize Devices within the rack elevation
|
# Serialize Devices within the rack elevation
|
||||||
for u in elevation:
|
for u in elevation:
|
||||||
|
Loading…
Reference in New Issue
Block a user