Restrict the length of the Security Group name input
There is an allowed maximum length for security group name field, but in current code, it doesn't check or restrict that from UI side, i.e. user will be able to type in more than what is allowed. After form submission, it will fail but there is no clear message telling user what caused failure. After adding the code to restrict the max length of the security group name field, user will not be able to input more than what is allowed, thus this error will be prevented from UI. Change-Id: I0f560e78e67a0259343f1a2c820270506653b254 Closes-Bug: #1279472
This commit is contained in:
parent
cf252d2252
commit
a3efea6586
@ -38,6 +38,7 @@ from openstack_dashboard.utils import filters
|
||||
|
||||
class CreateGroup(forms.SelfHandlingForm):
|
||||
name = forms.CharField(label=_("Name"),
|
||||
max_length=255,
|
||||
error_messages={
|
||||
'required': _('This field is required.'),
|
||||
'invalid': _("The string may only contain"
|
||||
@ -64,6 +65,7 @@ class CreateGroup(forms.SelfHandlingForm):
|
||||
class UpdateGroup(forms.SelfHandlingForm):
|
||||
id = forms.CharField(widget=forms.HiddenInput())
|
||||
name = forms.CharField(label=_("Name"),
|
||||
max_length=255,
|
||||
error_messages={
|
||||
'required': _('This field is required.'),
|
||||
'invalid': _("The string may only contain"
|
||||
|
Loading…
Reference in New Issue
Block a user