mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-16 04:02:52 -06:00
Fixes #17131: Fix exception when creating object-type custom field without selecting related object type
This commit is contained in:
parent
6a663e2a3e
commit
9e54cfe340
@ -352,13 +352,11 @@ class CustomField(CloningMixin, ExportTemplatesMixin, ChangeLoggedModel):
|
|||||||
if self.type in (CustomFieldTypeChoices.TYPE_OBJECT, CustomFieldTypeChoices.TYPE_MULTIOBJECT):
|
if self.type in (CustomFieldTypeChoices.TYPE_OBJECT, CustomFieldTypeChoices.TYPE_MULTIOBJECT):
|
||||||
if not self.related_object_type:
|
if not self.related_object_type:
|
||||||
raise ValidationError({
|
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:
|
elif self.related_object_type:
|
||||||
raise ValidationError({
|
raise ValidationError({
|
||||||
'object_type': _(
|
'type': _("{type} fields may not define an object type.") .format(type=self.get_type_display())
|
||||||
"{type} fields may not define an object type.")
|
|
||||||
.format(type=self.get_type_display())
|
|
||||||
})
|
})
|
||||||
|
|
||||||
def serialize(self, value):
|
def serialize(self, value):
|
||||||
|
Loading…
Reference in New Issue
Block a user