12255 remove can_swtich from template model

This commit is contained in:
Arthur 2023-04-20 11:41:55 -07:00
parent 74c22e4565
commit 7a69004801

View File

@ -59,7 +59,6 @@ class ComponentTemplateModel(WebhooksMixin, ChangeLoggedModel):
max_length=200, max_length=200,
blank=True blank=True
) )
_can_switch_device = False
class Meta: class Meta:
abstract = True abstract = True
@ -96,7 +95,7 @@ class ComponentTemplateModel(WebhooksMixin, ChangeLoggedModel):
def clean(self): def clean(self):
super().clean() super().clean()
if (not self._can_switch_device) and (self.pk is not None) and (self._original_device_type != self.device_type_id): if self.pk is not None and self._original_device_type != self.device_type_id:
raise ValidationError({ raise ValidationError({
"device_type": "Component templates cannot be moved to a different device type." "device_type": "Component templates cannot be moved to a different device type."
}) })
@ -642,7 +641,6 @@ class InventoryItemTemplate(MPTTModel, ComponentTemplateModel):
objects = TreeManager() objects = TreeManager()
component_model = InventoryItem component_model = InventoryItem
_can_switch_device = True
class Meta: class Meta:
ordering = ('device_type__id', 'parent__id', '_name') ordering = ('device_type__id', 'parent__id', '_name')