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
This commit is contained in:
Qian Min Chen 2018-07-09 22:04:39 +08:00
parent 91b85be715
commit 1d9d24e3dc
3 changed files with 5 additions and 9 deletions

View File

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

View File

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

View File

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