Fixes #17131: Fix exception when creating object-type custom field without selecting related object type

This commit is contained in:
Jeremy Stretch 2024-08-12 08:35:16 -04:00
parent 6a663e2a3e
commit 9e54cfe340

View File

@ -352,13 +352,11 @@ class CustomField(CloningMixin, ExportTemplatesMixin, ChangeLoggedModel):
if self.type in (CustomFieldTypeChoices.TYPE_OBJECT, CustomFieldTypeChoices.TYPE_MULTIOBJECT):
if not self.related_object_type:
raise ValidationError({
'object_type': _("Object fields must define an object type.")
'related_object_type': _("Object fields must define an object type.")
})
elif self.related_object_type:
raise ValidationError({
'object_type': _(
"{type} fields may not define an object type.")
.format(type=self.get_type_display())
'type': _("{type} fields may not define an object type.") .format(type=self.get_type_display())
})
def serialize(self, value):