Improved ValueError msg

This commit is contained in:
Genaro Camele 2025-10-13 16:29:24 -03:00 committed by GitHub
parent 04703dca8a
commit 9d8b176374
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1095,7 +1095,6 @@ class ModelSerializer(Serializer):
if field_name in info.relations and info.relations[field_name].to_many and declared_fields[field_name].default is None:
raise ValueError(
f"The field '{field_name}' on serializer '{self.__class__.__name__}' is a ManyToMany field and cannot have a default value of None."
"Please set an appropriate default value, such as an empty list, or remove the default."
)
for field_name in field_names: