Stop passing in the required attribute to form widgets.

This commit is contained in:
Jannis Leidel 2017-05-12 12:31:30 +02:00
Родитель cea92cb1bf
Коммит f60a65845a
3 изменённых файлов: 2 добавлений и 22 удалений

Просмотреть файл

@ -45,7 +45,6 @@ class NewClusterForm(AutoClassFormMixin, CreatedByModelFormMixin,
label='Identifier',
regex=r'^[a-z0-9-]{1,100}$',
widget=forms.TextInput(attrs={
'required': 'required',
'pattern': r'[a-z0-9-]{1,100}',
'data-parsley-pattern-message': 'Identifier contains invalid characters.',
}),
@ -59,7 +58,6 @@ class NewClusterForm(AutoClassFormMixin, CreatedByModelFormMixin,
min_value=1,
max_value=settings.AWS_CONFIG['MAX_CLUSTER_SIZE'],
widget=forms.NumberInput(attrs={
'required': 'required',
'min': '1',
'max': str(settings.AWS_CONFIG['MAX_CLUSTER_SIZE']),
}),
@ -73,7 +71,6 @@ class NewClusterForm(AutoClassFormMixin, CreatedByModelFormMixin,
min_value=2,
max_value=settings.AWS_CONFIG['MAX_CLUSTER_LIFETIME'],
widget=forms.NumberInput(attrs={
'required': 'required',
'min': '2',
'max': str(settings.AWS_CONFIG['MAX_CLUSTER_LIFETIME']),
}),
@ -86,9 +83,6 @@ class NewClusterForm(AutoClassFormMixin, CreatedByModelFormMixin,
queryset=SSHKey.objects.all(),
required=True,
empty_label=None,
widget=forms.Select(attrs={
'required': 'required',
}),
)
emr_release = EMRReleaseChoiceField()
@ -111,7 +105,6 @@ class NewClusterForm(AutoClassFormMixin, CreatedByModelFormMixin,
self.fields['ssh_key'].widget = forms.RadioSelect(
choices=self.fields['ssh_key'].choices,
attrs={
'required': 'required',
'class': 'radioset',
},
)
@ -125,7 +118,6 @@ class ExtendClusterForm(AutoClassFormMixin, forms.Form):
min_value=2,
max_value=settings.AWS_CONFIG['MAX_CLUSTER_LIFETIME'],
widget=forms.NumberInput(attrs={
'required': 'required',
'min': '2',
'max': str(settings.AWS_CONFIG['MAX_CLUSTER_LIFETIME']),
}),

Просмотреть файл

@ -21,7 +21,6 @@ class BaseSparkJobForm(AutoClassFormMixin, CachedFileModelFormMixin,
label='Identifier',
regex=r'^[a-z0-9-]{1,100}$',
widget=forms.TextInput(attrs={
'required': 'required',
'pattern': r'[a-z0-9-]{1,100}',
'data-parsley-pattern-message': 'Identifier contains invalid characters.',
}),
@ -34,7 +33,6 @@ class BaseSparkJobForm(AutoClassFormMixin, CachedFileModelFormMixin,
label='Description',
strip=True,
widget=forms.Textarea(attrs={
'required': 'required',
'rows': 2,
}),
help_text="A brief description of your Spark job's purpose. "
@ -42,9 +40,9 @@ class BaseSparkJobForm(AutoClassFormMixin, CachedFileModelFormMixin,
"data engineering team."
)
result_visibility = forms.ChoiceField(
required=True,
choices=models.SparkJob.RESULT_VISIBILITY_CHOICES,
widget=forms.RadioSelect(attrs={
'required': 'required',
'class': 'radioset',
}),
label='Result visibility',
@ -57,7 +55,6 @@ class BaseSparkJobForm(AutoClassFormMixin, CachedFileModelFormMixin,
max_value=settings.AWS_CONFIG['MAX_CLUSTER_SIZE'],
label='Cluster size',
widget=forms.NumberInput(attrs={
'required': 'required',
'min': '1',
'max': str(settings.AWS_CONFIG['MAX_CLUSTER_SIZE']),
}),
@ -65,9 +62,9 @@ class BaseSparkJobForm(AutoClassFormMixin, CachedFileModelFormMixin,
'(1 is recommended for testing or development).'
)
interval_in_hours = forms.ChoiceField(
required=True,
choices=models.SparkJob.INTERVAL_CHOICES,
widget=forms.RadioSelect(attrs={
'required': 'required',
'class': 'radioset',
}),
label='Run interval',
@ -79,7 +76,6 @@ class BaseSparkJobForm(AutoClassFormMixin, CachedFileModelFormMixin,
max_value=24,
label='Timeout',
widget=forms.NumberInput(attrs={
'required': 'required',
'min': '1',
'max': '24',
}),
@ -89,7 +85,6 @@ class BaseSparkJobForm(AutoClassFormMixin, CachedFileModelFormMixin,
start_date = forms.DateTimeField(
required=True,
widget=forms.DateTimeInput(attrs={
'required': 'required',
'class': 'datetimepicker',
}),
label='Start date',
@ -110,7 +105,6 @@ class BaseSparkJobForm(AutoClassFormMixin, CachedFileModelFormMixin,
required=True,
widget=forms.FileInput(attrs={
'accept': '.ipynb',
'required': 'required',
}),
label='Analysis Jupyter Notebook',
help_text='A Jupyter/IPython Notebook with a .ipynb file extension.'

Просмотреть файл

@ -54,14 +54,8 @@ class SSHKeyForm(AutoClassFormMixin, CreatedByModelFormMixin):
model = SSHKey
fields = ['title', 'key', 'key_file']
widgets = {
'title': forms.TextInput(
attrs={
'required': 'required',
},
),
'key': forms.Textarea(
attrs={
'required': 'required',
'placeholder': 'Drag and drop a key file with the ".pub" '
'file extension here, paste the content '
'manually or use the file selector below',