mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-19 09:53:34 -06:00
commit
b379918295
@ -187,7 +187,7 @@ class Rack(CreatedUpdatedModel):
|
|||||||
|
|
||||||
# Validate that Rack is tall enough to house the installed Devices
|
# Validate that Rack is tall enough to house the installed Devices
|
||||||
if self.pk:
|
if self.pk:
|
||||||
top_device = Device.objects.filter(rack=self).order_by('-position').first()
|
top_device = Device.objects.filter(rack=self).exclude(position__isnull=True).order_by('-position').first()
|
||||||
if top_device:
|
if top_device:
|
||||||
min_height = top_device.position + top_device.device_type.u_height - 1
|
min_height = top_device.position + top_device.device_type.u_height - 1
|
||||||
if self.u_height < min_height:
|
if self.u_height < min_height:
|
||||||
|
@ -120,7 +120,7 @@ class ObjectEditView(View):
|
|||||||
'obj': obj,
|
'obj': obj,
|
||||||
'obj_type': self.model._meta.verbose_name,
|
'obj_type': self.model._meta.verbose_name,
|
||||||
'form': form,
|
'form': form,
|
||||||
'cancel_url': reverse(self.cancel_url) if self.cancel_url else obj.get_absolute_url(),
|
'cancel_url': obj.get_absolute_url() if obj else reverse(self.cancel_url),
|
||||||
})
|
})
|
||||||
|
|
||||||
def post(self, request, *args, **kwargs):
|
def post(self, request, *args, **kwargs):
|
||||||
@ -157,7 +157,7 @@ class ObjectEditView(View):
|
|||||||
'obj': obj,
|
'obj': obj,
|
||||||
'obj_type': self.model._meta.verbose_name,
|
'obj_type': self.model._meta.verbose_name,
|
||||||
'form': form,
|
'form': form,
|
||||||
'cancel_url': reverse(self.cancel_url) if self.cancel_url else obj.get_absolute_url(),
|
'cancel_url': obj.get_absolute_url() if obj else reverse(self.cancel_url),
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user