Explorar o código

Fixed bug affecting initial position/face selection

Jeremy Stretch %!s(int64=10) %!d(string=hai) anos
pai
achega
54ad177e99
Modificáronse 1 ficheiros con 3 adicións e 6 borrados
  1. 3 6
      netbox/dcim/forms.py

+ 3 - 6
netbox/dcim/forms.py

@@ -325,13 +325,10 @@ class DeviceForm(forms.ModelForm, BootstrapMixin):
             self.fields['rack'].choices = []
             self.fields['rack'].choices = []
 
 
         # Rack position
         # Rack position
-        face = self.data.get('face')
-        if face == '':
-            face = None
         try:
         try:
-            if self.is_bound and self.data.get('rack') and face is not None:
-                position_choices = Rack.objects.get(pk=self.data['rack']).get_rack_units(face=face)
-            elif self.initial.get('rack') and face is not None:
+            if self.is_bound and self.data.get('rack') and self.data.get('face') is not None:
+                position_choices = Rack.objects.get(pk=self.data['rack']).get_rack_units(face=self.data.get('face'))
+            elif self.initial.get('rack') and self.initial.get('face') is not None:
                 position_choices = Rack.objects.get(pk=self.initial['rack']).get_rack_units(face=self.initial.get('face'))
                 position_choices = Rack.objects.get(pk=self.initial['rack']).get_rack_units(face=self.initial.get('face'))
             else:
             else:
                 position_choices = []
                 position_choices = []