@@ -649,13 +649,15 @@ def check_allowed_values(self, attribute: str, field_list: list[str], allowed_va
649649
650650 """
651651 class_list = getattr (self , attribute )
652- for model in class_list :
652+ for index , model in enumerate ( class_list ) :
653653 for field in field_list :
654654 value = getattr (model , field , "" )
655655 if value and value not in allowed_values :
656656 raise ValueError (
657- f'The value "{ value } " in the "{ field } " field of "{ attribute } " must be defined in '
658- f'"{ values_defined_in [f"{ attribute } .{ field } " ]} ".' ,
657+ f'The value "{ value } " used in the "{ field } " field at index { index } of "{ attribute } " '
658+ f'must be defined in "{ values_defined_in [f"{ attribute } .{ field } " ]} ". Please either add '
659+ f'"{ value } " to "{ values_defined_in [f"{ attribute } .{ field } " ]} " before including it in'
660+ f' "{ attribute } ", or remove it from "{ attribute } .{ field } " before attempting to delete it.' ,
659661 )
660662
661663 def check_allowed_source (self , attribute : str ) -> None :
@@ -945,7 +947,7 @@ def wrapped_func(*args, **kwargs):
945947 Project .model_validate (self )
946948 except ValidationError as exc :
947949 class_list .data = previous_state
948- custom_error_list = custom_pydantic_validation_error (exc .errors ())
950+ custom_error_list = custom_pydantic_validation_error (exc .errors (include_url = False ))
949951 raise ValidationError .from_exception_data (exc .title , custom_error_list , hide_input = True ) from None
950952 except (TypeError , ValueError ):
951953 class_list .data = previous_state
0 commit comments