Browse Source

Merge pull request #57 from digitalocean/develop

Release 1.0.3-r1
Jeremy Stretch 9 years ago
parent
commit
b379918295
2 changed files with 3 additions and 3 deletions
  1. 1 1
      netbox/dcim/models.py
  2. 2 2
      netbox/utilities/views.py

+ 1 - 1
netbox/dcim/models.py

@@ -187,7 +187,7 @@ class Rack(CreatedUpdatedModel):
 
         # Validate that Rack is tall enough to house the installed Devices
         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:
                 min_height = top_device.position + top_device.device_type.u_height - 1
                 if self.u_height < min_height:

+ 2 - 2
netbox/utilities/views.py

@@ -120,7 +120,7 @@ class ObjectEditView(View):
             'obj': obj,
             'obj_type': self.model._meta.verbose_name,
             '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):
@@ -157,7 +157,7 @@ class ObjectEditView(View):
             'obj': obj,
             'obj_type': self.model._meta.verbose_name,
             '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),
         })