Marking CIDR as mandatory field on Add rule form in security_group panel

When selecting the remote as CIDR,
the CIDR value field is mandatory but isn't marked as mandatory.
This patch marks it as mandatory.

Change-Id: I2125813d6fb58e311b6bef821a88c78ab0fc6cfc
Closes-Bug: #1816330
This commit is contained in:
pengyuesheng 2019-02-18 09:58:38 +08:00
parent d63a65683a
commit cf9def203c
1 changed files with 9 additions and 8 deletions

View File

@ -230,17 +230,18 @@ class AddRule(forms.SelfHandlingForm):
mask=True, mask=True,
widget=forms.TextInput( widget=forms.TextInput(
attrs={'class': 'switched', attrs={'class': 'switched',
'data-required-when-shown': 'true',
'data-switch-on': 'remote', 'data-switch-on': 'remote',
'data-remote-cidr': _('CIDR')})) 'data-remote-cidr': _('CIDR')}))
security_group = forms.ChoiceField(label=_('Security Group'), security_group = forms.ChoiceField(
required=False, label=_('Security Group'),
widget=forms.ThemableSelectWidget( required=False,
attrs={ widget=forms.ThemableSelectWidget(attrs={
'class': 'switched', 'class': 'switched',
'data-switch-on': 'remote', 'data-required-when-shown': 'true',
'data-remote-sg': _('Security ' 'data-switch-on': 'remote',
'Group')})) 'data-remote-sg': _('Security Group')}))
# When cidr is used ethertype is determined from IP version of cidr. # When cidr is used ethertype is determined from IP version of cidr.
# When source group, ethertype needs to be specified explicitly. # When source group, ethertype needs to be specified explicitly.
ethertype = forms.ChoiceField(label=_('Ether Type'), ethertype = forms.ChoiceField(label=_('Ether Type'),