Cleanup for Horizon fields

Since 'True' is the default value for 'required',
additional assignments are not needed.

Change-Id: I11ae029949e6245af1cf8b0c83825a2ed384aec4
This commit is contained in:
Tatiana Ovchinnikova 2014-07-25 11:47:26 +04:00
parent 1ea96903f0
commit 9621ea3a90
16 changed files with 22 additions and 48 deletions

View File

@ -30,8 +30,7 @@ LOG = logging.getLogger(__name__)
class CreateDomainInfoAction(workflows.Action):
name = forms.CharField(label=_("Name"),
required=True)
name = forms.CharField(label=_("Name"))
description = forms.CharField(widget=forms.widgets.Textarea(),
label=_("Description"),
required=False)

View File

@ -27,8 +27,7 @@ LOG = logging.getLogger(__name__)
class CreateGroupForm(forms.SelfHandlingForm):
name = forms.CharField(label=_("Name"),
required=True)
name = forms.CharField(label=_("Name"))
description = forms.CharField(widget=forms.widgets.Textarea(),
label=_("Description"),
required=False)
@ -53,8 +52,7 @@ class CreateGroupForm(forms.SelfHandlingForm):
class UpdateGroupForm(forms.SelfHandlingForm):
group_id = forms.CharField(widget=forms.HiddenInput())
name = forms.CharField(label=_("Name"),
required=True)
name = forms.CharField(label=_("Name"))
description = forms.CharField(widget=forms.widgets.Textarea(),
label=_("Description"),
required=False)

View File

@ -29,7 +29,6 @@ class LiveMigrateForm(forms.SelfHandlingForm):
widget=forms.TextInput(
attrs={'readonly': 'readonly'}))
host = forms.ChoiceField(label=_("New Host"),
required=True,
help_text=_("Choose a Host to migrate to."))
disk_over_commit = forms.BooleanField(label=_("Disk Over Commit"),
initial=False, required=False)

View File

@ -165,8 +165,7 @@ class UpdateCell(tables.UpdateAction):
class TenantsTable(tables.DataTable):
name = tables.Column('name', verbose_name=_('Name'),
form_field=forms.CharField(required=True,
max_length=64),
form_field=forms.CharField(max_length=64),
update_action=UpdateCell)
description = tables.Column(lambda obj: getattr(obj, 'description', None),
verbose_name=_('Description'),

View File

@ -48,7 +48,6 @@ class CreateContainer(forms.SelfHandlingForm):
label=_("Container Name"),
validators=[no_slash_validator])
access = forms.ChoiceField(label=_("Container Access"),
required=True,
choices=ACCESS_CHOICES)
def handle(self, request, data):

View File

@ -118,7 +118,6 @@ class SetInstanceDetails(workflows.Step):
class SetNetworkAction(workflows.Action):
network = forms.MultipleChoiceField(label=_("Networks"),
required=True,
widget=forms.CheckboxSelectMultiple(),
error_messages={
'required': _(

View File

@ -142,8 +142,7 @@ class UpdateFirewall(forms.SelfHandlingForm):
description = forms.CharField(max_length=80,
label=_("Description"),
required=False)
firewall_policy_id = forms.ChoiceField(label=_("Policy"),
required=True)
firewall_policy_id = forms.ChoiceField(label=_("Policy"))
admin_state_up = forms.BooleanField(label=_("Admin State Up"),
required=False)

View File

@ -174,8 +174,7 @@ class SelectRulesStep(workflows.Step):
class AddPolicyAction(workflows.Action):
name = forms.CharField(max_length=80,
label=_("Name"),
required=True)
label=_("Name"))
description = forms.CharField(max_length=80,
label=_("Description"),
required=False)
@ -237,8 +236,7 @@ class AddFirewallAction(workflows.Action):
description = forms.CharField(max_length=80,
label=_("Description"),
required=False)
firewall_policy_id = forms.ChoiceField(label=_("Policy"),
required=True)
firewall_policy_id = forms.ChoiceField(label=_("Policy"))
shared = forms.BooleanField(label=_("Shared"),
initial=False,
required=False)

View File

@ -37,7 +37,7 @@ IMAGE_FORMAT_CHOICES = IMAGE_BACKEND_SETTINGS.get('image_formats', [])
class CreateImageForm(forms.SelfHandlingForm):
name = forms.CharField(max_length="255", label=_("Name"), required=True)
name = forms.CharField(max_length="255", label=_("Name"))
description = forms.CharField(widget=forms.widgets.Textarea(
attrs={'class': 'modal-body-fixed-width'}),
label=_("Description"),
@ -69,7 +69,6 @@ class CreateImageForm(forms.SelfHandlingForm):
'data-source-file': _('Image File')}),
required=False)
disk_format = forms.ChoiceField(label=_('Format'),
required=True,
choices=[],
widget=forms.Select(attrs={'class':
'switchable'}))

View File

@ -143,12 +143,10 @@ class DecryptPasswordInstanceForm(forms.SelfHandlingForm):
self.fields['encrypted_password'].initial = result
self.fields['private_key_file'] = forms.FileField(
label=_('Private Key File'),
widget=forms.FileInput(),
required=True)
widget=forms.FileInput())
self.fields['private_key'] = forms.CharField(
widget=forms.widgets.Textarea(),
label=_("OR Copy/Paste your Private Key"),
required=True)
label=_("OR Copy/Paste your Private Key"))
_attrs = {'readonly': 'readonly'}
self.fields['decrypted_password'] = forms.CharField(
widget=forms.widgets.TextInput(_attrs),

View File

@ -89,7 +89,6 @@ class SetInstanceDetailsAction(workflows.Action):
help_text=_("Number of instances to launch."))
source_type = forms.ChoiceField(label=_("Instance Boot Source"),
required=True,
help_text=_("Choose Your Boot Source "
"Type."))
@ -461,7 +460,6 @@ class SetAccessControlsAction(workflows.Action):
required=False,
widget=forms.PasswordInput(render_value=False))
groups = forms.MultipleChoiceField(label=_("Security Groups"),
required=True,
initial=["default"],
widget=forms.CheckboxSelectMultiple(),
help_text=_("Launch instance in these "
@ -553,7 +551,6 @@ class PostCreationStep(workflows.Step):
class SetNetworkAction(workflows.Action):
network = forms.MultipleChoiceField(label=_("Networks"),
required=True,
widget=forms.CheckboxSelectMultiple(),
error_messages={
'required': _(

View File

@ -38,7 +38,6 @@ class SetFlavorChoiceAction(workflows.Action):
attrs={'readonly': 'readonly'}
))
flavor = forms.ChoiceField(label=_("New Flavor"),
required=True,
help_text=_("Choose the flavor to launch."))
class Meta:

View File

@ -102,8 +102,7 @@ class UpdateInstanceSecurityGroups(workflows.UpdateMembersStep):
class UpdateInstanceInfoAction(workflows.Action):
name = forms.CharField(required=True,
label=_("Name"),
name = forms.CharField(label=_("Name"),
max_length=255)
def handle(self, request, data):

View File

@ -46,10 +46,10 @@ class RuleCIDRField(forms.IPField):
class AddRouterRule(forms.SelfHandlingForm):
source = RuleCIDRField(label=_("Source CIDR"),
widget=forms.TextInput(), required=True)
widget=forms.TextInput())
destination = RuleCIDRField(label=_("Destination CIDR"),
widget=forms.TextInput(), required=True)
action = forms.ChoiceField(label=_("Action"), required=True)
widget=forms.TextInput())
action = forms.ChoiceField(label=_("Action"))
nexthops = forms.MultiIPField(label=_("Optional: Next Hop "
"Addresses (comma delimited)"),
widget=forms.TextInput(), required=False)

View File

@ -227,8 +227,7 @@ class ChangeTemplateForm(TemplateForm):
help_text = _('From here you can select a new template to re-launch '
'a stack.')
stack_id = forms.CharField(label=_('Stack ID'),
widget=forms.widgets.HiddenInput,
required=True)
widget=forms.widgets.HiddenInput)
stack_name = forms.CharField(label=_('Stack Name'),
widget=forms.TextInput(
attrs={'readonly': 'readonly'}
@ -252,8 +251,7 @@ class CreateStackForm(forms.SelfHandlingForm):
widget=forms.widgets.HiddenInput,
required=False)
parameters = forms.CharField(
widget=forms.widgets.HiddenInput,
required=True)
widget=forms.widgets.HiddenInput)
stack_name = forms.RegexField(
max_length='255',
label=_('Stack Name'),
@ -261,13 +259,11 @@ class CreateStackForm(forms.SelfHandlingForm):
regex=r"^[a-zA-Z][a-zA-Z0-9_.-]*$",
error_messages={'invalid': _('Name must start with a letter and may '
'only contain letters, numbers, underscores, '
'periods and hyphens.')},
required=True)
'periods and hyphens.')})
timeout_mins = forms.IntegerField(
initial=60,
label=_('Creation Timeout (minutes)'),
help_text=_('Stack creation timeout in minutes.'),
required=True)
help_text=_('Stack creation timeout in minutes.'))
enable_rollback = forms.BooleanField(
label=_('Rollback On Failure'),
help_text=_('Enable rollback on create/update failure.'),
@ -286,7 +282,6 @@ class CreateStackForm(forms.SelfHandlingForm):
label=_('Password for user "%s"') % self.request.user.username,
help_text=_('This is required for operations to be performed '
'throughout the lifecycle of the stack'),
required=True,
widget=forms.PasswordInput())
self.help_text = template_validate['Description']
@ -361,8 +356,7 @@ class EditStackForm(CreateStackForm):
name = _('Update Stack Parameters')
stack_id = forms.CharField(label=_('Stack ID'),
widget=forms.widgets.HiddenInput,
required=True)
widget=forms.widgets.HiddenInput)
stack_name = forms.CharField(label=_('Stack Name'),
widget=forms.TextInput(
attrs={'readonly': 'readonly'}

View File

@ -47,8 +47,7 @@ class CreateNetworkProfile(forms.SelfHandlingForm):
"""Create Network Profile form."""
name = forms.CharField(max_length=255,
label=_("Name"),
required=True)
label=_("Name"))
segment_type = forms.ChoiceField(label=_('Segment Type'),
choices=[('vlan', _('VLAN')),
('overlay', _('Overlay')),
@ -179,15 +178,14 @@ class UpdateNetworkProfile(forms.SelfHandlingForm):
profile_id = forms.CharField(label=_("ID"),
widget=forms.HiddenInput())
name = forms.CharField(max_length=255,
label=_("Name"), required=True)
label=_("Name"))
segment_type = forms.ChoiceField(label=_('Segment Type'),
choices=[('vlan', 'VLAN'),
('vxlan', 'VXLAN')],
widget=forms.Select
(attrs={'class': 'switchable'}))
segment_range = forms.CharField(max_length=255,
label=_("Segment Range"),
required=True)
label=_("Segment Range"))
physical_network = forms.CharField(max_length=255,
label=_("Physical Network"),
required=False)