2712: lint changes

This commit is contained in:
Ulrich K 2023-05-10 09:44:45 +02:00
parent f9126a124e
commit e27dae34ba

View file

@ -54,17 +54,21 @@ class CustomForm(StyledForm):
# TODO this (finding the field) is much too complicated; probably this is not the right location?
# it is however more or less what super().add_error does...
if (field is None):
if field is None:
if isinstance(error, dict):
for field_name, messages in error.items():
if field_name in self.fields:
self.add_to_attributes(self.fields[field_name], "class", "is-danger")
self.add_to_attributes(
self.fields[field_name], "class", "is-danger"
)
elif isinstance(error, ValidationError):
if hasattr(error, 'error_dict'):
if hasattr(error, "error_dict"):
error = error.error_dict
for field_name, error_list in error.items():
if field_name in self.fields:
self.add_to_attributes(self.fields[field_name], "class", "is-danger")
self.add_to_attributes(
self.fields[field_name], "class", "is-danger"
)
else:
self.add_to_attributes(field, "class", "is-danger")