From 1d9d24e3dc7676692641b76fd68b46eda4a19a3a Mon Sep 17 00:00:00 2001 From: Qian Min Chen Date: Mon, 9 Jul 2018 22:04:39 +0800 Subject: [PATCH] Remove the redundant "required=True" The django form field default is "required=True", so this patch remove the redundant "required=True" in the form. Change-Id: If9d8320e14a32b24bbbac1c6a99597695e58b783 --- cloudkittydashboard/dashboards/admin/hashmap/forms.py | 9 +++------ cloudkittydashboard/dashboards/admin/modules/forms.py | 2 +- cloudkittydashboard/dashboards/admin/pyscripts/forms.py | 3 +-- 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/cloudkittydashboard/dashboards/admin/hashmap/forms.py b/cloudkittydashboard/dashboards/admin/hashmap/forms.py index 8521eb9..f1cceca 100644 --- a/cloudkittydashboard/dashboards/admin/hashmap/forms.py +++ b/cloudkittydashboard/dashboards/admin/hashmap/forms.py @@ -33,8 +33,7 @@ class CreateServiceForm(forms.SelfHandlingForm): choices=services_choices, widget=forms.Select(attrs={ 'class': 'switchable', - 'data-slug': 'servicetype'}), - required=True) + 'data-slug': 'servicetype'})) service = forms.DynamicChoiceField( label=_("Service"), help_text=_("Services are provided by main collector."), @@ -101,13 +100,11 @@ class CreateFieldForm(forms.SelfHandlingForm): fields = api.identify(fields) choices = sorted([(field, field) for field in fields.metadata]) self.fields['field'] = forms.DynamicChoiceField( - label=_("Field"), - required=True) + label=_("Field")) self.fields['field'].choices = choices else: self.fields['field'] = forms.CharField( - label=_("Field"), - required=True) + label=_("Field")) class CreateGroupForm(forms.SelfHandlingForm): diff --git a/cloudkittydashboard/dashboards/admin/modules/forms.py b/cloudkittydashboard/dashboards/admin/modules/forms.py index ad08dbd..2adc94a 100644 --- a/cloudkittydashboard/dashboards/admin/modules/forms.py +++ b/cloudkittydashboard/dashboards/admin/modules/forms.py @@ -23,7 +23,7 @@ LOG = logging.getLogger(__name__) class EditPriorityForm(forms.SelfHandlingForm): - priority = forms.IntegerField(label=_("Priority"), required=True) + priority = forms.IntegerField(label=_("Priority")) def handle(self, request, data): ck_client = api.cloudkittyclient(request) diff --git a/cloudkittydashboard/dashboards/admin/pyscripts/forms.py b/cloudkittydashboard/dashboards/admin/pyscripts/forms.py index 2f076f1..f495c26 100644 --- a/cloudkittydashboard/dashboards/admin/pyscripts/forms.py +++ b/cloudkittydashboard/dashboards/admin/pyscripts/forms.py @@ -33,8 +33,7 @@ class CreateScriptForm(forms.SelfHandlingForm): choices=source_choices, widget=forms.Select(attrs={ 'class': 'switchable', - 'data-slug': 'scriptsource'}), - required=True) + 'data-slug': 'scriptsource'})) script_help = _("A script or set of python commands to modify rating " "calculations.") script_upload = forms.FileField(