Make create env show the correct error message
Now create env with null name or space only show: "This field is required" error message, didn't show the correct message: "Environment name must contain at least one non-white space symbol." This will also fix the dashboard functional test cases about create env. Change-Id: I4f2be3320eeb02e0d0953eee8426cc5aae685865 Closes-Bug: #1735035
This commit is contained in:
parent
5cbd08e64a
commit
bb4f3ffc4b
@ -67,12 +67,12 @@ class CreateEnvironmentForm(horizon_forms.SelfHandlingForm):
|
||||
self.fields['net_config'].choices = net_choices
|
||||
self.fields['net_config'].help_text = help_text
|
||||
|
||||
def clean_name(self):
|
||||
def clean(self):
|
||||
cleaned_data = super(CreateEnvironmentForm, self).clean()
|
||||
env_name = cleaned_data.get('name')
|
||||
if not env_name.strip():
|
||||
if not env_name or not env_name.strip():
|
||||
self._errors['name'] = self.error_class([ENV_NAME_HELP_TEXT])
|
||||
return env_name
|
||||
return cleaned_data
|
||||
|
||||
def handle(self, request, data):
|
||||
try:
|
||||
|
Loading…
Reference in New Issue
Block a user