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