Skip to content

Commit 9e54cfe

Browse files
committed
Fixes #17131: Fix exception when creating object-type custom field without selecting related object type
1 parent 6a663e2 commit 9e54cfe

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

netbox/extras/models/customfields.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -352,13 +352,11 @@ def clean(self):
352352
if self.type in (CustomFieldTypeChoices.TYPE_OBJECT, CustomFieldTypeChoices.TYPE_MULTIOBJECT):
353353
if not self.related_object_type:
354354
raise ValidationError({
355-
'object_type': _("Object fields must define an object type.")
355+
'related_object_type': _("Object fields must define an object type.")
356356
})
357357
elif self.related_object_type:
358358
raise ValidationError({
359-
'object_type': _(
360-
"{type} fields may not define an object type.")
361-
.format(type=self.get_type_display())
359+
'type': _("{type} fields may not define an object type.") .format(type=self.get_type_display())
362360
})
363361

364362
def serialize(self, value):

0 commit comments

Comments
 (0)