13757 Fix ConfigContext reference to DeviceType (#13804)

* 13757 do prefetch to work around Django issue with vars in init (DeviceType)

* 13757 use self.__dict to access vars in init

* 13757 change test
This commit is contained in:
Arthur Hanson
2023-09-20 06:56:52 -07:00
committed by GitHub
parent 30886d947c
commit a7b90acc05
7 changed files with 16 additions and 14 deletions

View File

@@ -205,11 +205,11 @@ class DeviceType(ImageAttachmentsMixin, PrimaryModel, WeightMixin):
super().__init__(*args, **kwargs)
# Save a copy of u_height for validation in clean()
self._original_u_height = self.u_height
self._original_u_height = self.__dict__.get('u_height')
# Save references to the original front/rear images
self._original_front_image = self.front_image
self._original_rear_image = self.rear_image
self._original_front_image = self.__dict__.get('front_image')
self._original_rear_image = self.__dict__.get('rear_image')
def get_absolute_url(self):
return reverse('dcim:devicetype', args=[self.pk])