Merge "Fix issues on create network and create port modals"

This commit is contained in:
Jenkins 2017-01-26 17:24:55 +00:00 committed by Gerrit Code Review
commit 2e1118149b
4 changed files with 11 additions and 10 deletions

View File

@ -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')

View File

@ -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"),

View File

@ -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)

View File

@ -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'