Add asterisk mark for the required field on CreateNamespaceForm

on Create Namespace Form in metadata defs panel,
the metadef_file and direct_input is not required,
but if we not input, an error was shown.

This patch Add asterisk mark for the required field

Change-Id: I796b1516b5ce95eebe0c7cb066460f1e21a07cc9
Closes-Bug: #1831197
This commit is contained in:
pengyuesheng 2019-05-31 13:48:50 +08:00
parent acc36f4958
commit 9c04063c03

View File

@ -34,7 +34,6 @@ from openstack_dashboard.dashboards.admin.metadata_defs \
class CreateNamespaceForm(forms.SelfHandlingForm):
source_type = forms.ChoiceField(
label=_('Namespace Definition Source'),
required=False,
choices=[('file', _('Metadata Definition File')),
('raw', _('Direct Input'))],
widget=forms.ThemableSelectWidget(
@ -45,6 +44,7 @@ class CreateNamespaceForm(forms.SelfHandlingForm):
help_text=_("A local metadata definition file to upload."),
widget=forms.FileInput(
attrs={'class': 'switched', 'data-switch-on': 'source',
'data-required-when-shown': 'true',
'data-source-file': _('Metadata Definition File')}),
required=False)
@ -53,6 +53,7 @@ class CreateNamespaceForm(forms.SelfHandlingForm):
help_text=_('The JSON formatted contents of a namespace.'),
widget=forms.widgets.Textarea(
attrs={'class': 'switched', 'data-switch-on': 'source',
'data-required-when-shown': 'true',
'data-source-raw': _('Namespace JSON')}),
required=False)