From 9c04063c033a1f707b6befdc66280a426fba78e3 Mon Sep 17 00:00:00 2001 From: pengyuesheng Date: Fri, 31 May 2019 13:48:50 +0800 Subject: [PATCH] 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 --- openstack_dashboard/dashboards/admin/metadata_defs/forms.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/openstack_dashboard/dashboards/admin/metadata_defs/forms.py b/openstack_dashboard/dashboards/admin/metadata_defs/forms.py index 0650149f5d..5ef64ac8f1 100644 --- a/openstack_dashboard/dashboards/admin/metadata_defs/forms.py +++ b/openstack_dashboard/dashboards/admin/metadata_defs/forms.py @@ -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)