mirror of
https://github.com/netbox-community/netbox.git
synced 2026-01-23 03:58:45 -06:00
Closes #17577: Reference ModelState when determining whether an object is being created
This commit is contained in:
@@ -98,7 +98,7 @@ class ComponentTemplateModel(ChangeLoggedModel, TrackingModelMixin):
|
||||
def clean(self):
|
||||
super().clean()
|
||||
|
||||
if self.pk is not None and self._original_device_type != self.device_type_id:
|
||||
if not self._state.adding and self._original_device_type != self.device_type_id:
|
||||
raise ValidationError({
|
||||
"device_type": _("Component templates cannot be moved to a different device type.")
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user