Explorar o código

Fixes #3898: Call str of cable on delete to save PK in id_string

Saria Hajjar %!s(int64=6) %!d(string=hai) anos
pai
achega
a2308b9c99
Modificáronse 2 ficheiros con 6 adicións e 0 borrados
  1. 1 0
      docs/release-notes/version-2.6.md
  2. 5 0
      netbox/dcim/models.py

+ 1 - 0
docs/release-notes/version-2.6.md

@@ -28,6 +28,7 @@
 * [#3872](https://github.com/netbox-community/netbox/issues/3872) - Paginate related IPs of an address
 * [#3876](https://github.com/netbox-community/netbox/issues/3876) - Fixed min/max to ASN input field at the site creation page
 * [#3882](https://github.com/netbox-community/netbox/issues/3882) - Fix filtering of devices by rack group
+* [#3898](https://github.com/netbox-community/netbox/issues/3898) - Fix deleted message being set to None for cable 
 
 ---
 

+ 5 - 0
netbox/dcim/models.py

@@ -3040,6 +3040,11 @@ class Cable(ChangeLoggedModel):
     def get_absolute_url(self):
         return reverse('dcim:cable', args=[self.pk])
 
+    def delete(self, *args, **kwargs):
+        # Trigger the __str__ method to save the pk into `self.id_string`
+        str(self)
+        super().delete(*args, **kwargs)
+
     def clean(self):
 
         # Validate that termination A exists