Przeglądaj źródła

Merge pull request #1327 from digitalocean/develop

Release v2.0.9
Jeremy Stretch 8 lat temu
rodzic
commit
e05d379101

+ 1 - 1
docs/data-model/extras.md

@@ -119,7 +119,7 @@ Each line of the **device patterns** field represents a hierarchical layer withi
 ```
 ```
 core-switch-[abcd]
 core-switch-[abcd]
 dist-switch\d
 dist-switch\d
-access-switch\d+,oob-switch\d+
+access-switch\d+;oob-switch\d+
 ```
 ```
 
 
 Note that you can combine multiple regexes onto one line using semicolons. The order in which regexes are listed on a line is significant: devices matching the first regex will be rendered first, and subsequent groups will be rendered to the right of those.
 Note that you can combine multiple regexes onto one line using semicolons. The order in which regexes are listed on a line is significant: devices matching the first regex will be rendered first, and subsequent groups will be rendered to the right of those.

+ 8 - 3
netbox/circuits/forms.py

@@ -252,6 +252,11 @@ class CircuitTerminationForm(BootstrapMixin, ChainedFieldsMixin, forms.ModelForm
         super(CircuitTerminationForm, self).__init__(*args, **kwargs)
         super(CircuitTerminationForm, self).__init__(*args, **kwargs)
 
 
         # Mark connected interfaces as disabled
         # Mark connected interfaces as disabled
-        self.fields['interface'].choices = [
-            (iface.id, {'label': iface.name, 'disabled': iface.is_connected}) for iface in self.fields['interface'].queryset
-        ]
+        self.fields['interface'].choices = []
+        for iface in self.fields['interface'].queryset:
+            self.fields['interface'].choices.append(
+                (iface.id, {
+                    'label': iface.name,
+                    'disabled': iface.is_connected and iface.pk != self.initial.get('interface'),
+                })
+            )

+ 1 - 1
netbox/netbox/settings.py

@@ -13,7 +13,7 @@ except ImportError:
     )
     )
 
 
 
 
-VERSION = '2.0.8'
+VERSION = '2.0.9'
 
 
 # Import required configuration parameters
 # Import required configuration parameters
 ALLOWED_HOSTS = DATABASE = SECRET_KEY = None
 ALLOWED_HOSTS = DATABASE = SECRET_KEY = None

+ 1 - 1
netbox/utilities/forms.py

@@ -489,7 +489,7 @@ class ChainedFieldsMixin(forms.BaseForm):
 
 
                 if filters_dict:
                 if filters_dict:
                     field.queryset = field.queryset.filter(**filters_dict)
                     field.queryset = field.queryset.filter(**filters_dict)
-                elif not self.is_bound and self.instance and hasattr(self.instance, field_name):
+                elif not self.is_bound and getattr(self, 'instance', None) and hasattr(self.instance, field_name):
                     obj = getattr(self.instance, field_name)
                     obj = getattr(self.instance, field_name)
                     if obj is not None:
                     if obj is not None:
                         field.queryset = field.queryset.filter(pk=obj.pk)
                         field.queryset = field.queryset.filter(pk=obj.pk)