Change the way of verifying field cidr
If don't choice 'Create Subnet', the subnet section will not show, but form is blocked by validation of field cidr is required, set required to false and using conditional statement to determine. Closes-Bug: #1832804 Change-Id: Iadb6ba54262f2848933fc0c7bf547b2c6458e82b
This commit is contained in:
parent
2cb84ade8a
commit
26146458ea
|
@ -139,6 +139,7 @@ class CreateSubnetInfoAction(workflows.Action):
|
|||
required=False)
|
||||
|
||||
cidr = forms.IPField(label=_("Network Address"),
|
||||
required=False,
|
||||
initial="",
|
||||
error_messages={
|
||||
'required': _('Specify "Network Address" or '
|
||||
|
@ -287,6 +288,10 @@ class CreateSubnetInfoAction(workflows.Action):
|
|||
'"Enter Network Address manually" and specify '
|
||||
'"Network Address".')
|
||||
raise forms.ValidationError(msg)
|
||||
if not cidr and address_source != 'subnetpool':
|
||||
msg = _('Specify "Network Address" or '
|
||||
'clear "Create Subnet" checkbox in previous step.')
|
||||
raise forms.ValidationError(msg)
|
||||
if address_source == 'subnetpool' and 'cidr' in self._errors:
|
||||
del self._errors['cidr']
|
||||
elif cidr:
|
||||
|
|
Loading…
Reference in New Issue