diff --git a/openstack_dashboard/dashboards/admin/networks/forms.py b/openstack_dashboard/dashboards/admin/networks/forms.py index 41774a7632..e57575ef3d 100644 --- a/openstack_dashboard/dashboards/admin/networks/forms.py +++ b/openstack_dashboard/dashboards/admin/networks/forms.py @@ -126,8 +126,8 @@ class CreateNetwork(forms.SelfHandlingForm): 'data-switch-on': 'network_type', })) admin_state = forms.ThemableChoiceField( - choices=[(True, _('UP')), - (False, _('DOWN'))], + choices=[('True', _('UP')), + ('False', _('DOWN'))], label=_("Admin State")) shared = forms.BooleanField(label=_("Shared"), initial=False, required=False) @@ -288,9 +288,10 @@ class CreateNetwork(forms.SelfHandlingForm): def _clean_segmentation_id(self, data): network_type = data.get('network_type') if 'segmentation_id' in self._errors: - if network_type not in self.nettypes_with_seg_id: + if (network_type not in self.nettypes_with_seg_id and + not self.data.get("segmentation_id")): # In this case the segmentation ID is not required, so we can - # ignore any errors. + # ignore the field is required error. del self._errors['segmentation_id'] elif network_type in self.nettypes_with_seg_id: seg_id = data.get('segmentation_id') diff --git a/openstack_dashboard/dashboards/admin/networks/ports/forms.py b/openstack_dashboard/dashboards/admin/networks/ports/forms.py index d60d1c9b0b..521f37a965 100644 --- a/openstack_dashboard/dashboards/admin/networks/ports/forms.py +++ b/openstack_dashboard/dashboards/admin/networks/ports/forms.py @@ -43,8 +43,8 @@ class CreatePort(forms.SelfHandlingForm): name = forms.CharField(max_length=255, label=_("Name"), required=False) - admin_state = forms.ThemableChoiceField(choices=[(True, _('UP')), - (False, _('DOWN'))], + admin_state = forms.ThemableChoiceField(choices=[('True', _('UP')), + ('False', _('DOWN'))], label=_("Admin State")) device_id = forms.CharField(max_length=100, label=_("Device ID"), help_text=_("Device ID attached to the port"), diff --git a/openstack_dashboard/dashboards/project/networks/forms.py b/openstack_dashboard/dashboards/project/networks/forms.py index da4fcbcd6f..767f37d9b9 100644 --- a/openstack_dashboard/dashboards/project/networks/forms.py +++ b/openstack_dashboard/dashboards/project/networks/forms.py @@ -39,8 +39,8 @@ class UpdateNetwork(forms.SelfHandlingForm): widget=forms.TextInput( attrs={'readonly': 'readonly'})) admin_state = forms.ThemableChoiceField( - choices=[(True, _('UP')), - (False, _('DOWN'))], + choices=[('True', _('UP')), + ('False', _('DOWN'))], required=False, label=_("Admin State")) shared = forms.BooleanField(label=_("Shared"), required=False) diff --git a/openstack_dashboard/dashboards/project/networks/ports/forms.py b/openstack_dashboard/dashboards/project/networks/ports/forms.py index e907ccd4f5..f373ab4a2f 100644 --- a/openstack_dashboard/dashboards/project/networks/ports/forms.py +++ b/openstack_dashboard/dashboards/project/networks/ports/forms.py @@ -39,8 +39,8 @@ class UpdatePort(forms.SelfHandlingForm): label=_("Name"), required=False) admin_state = forms.ThemableChoiceField( - choices=[(True, _('UP')), - (False, _('DOWN'))], + choices=[('True', _('UP')), + ('False', _('DOWN'))], label=_("Admin State")) failure_url = 'horizon:project:networks:detail'