1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00

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

This commit is contained in:
Saria Hajjar
2020-01-12 11:08:13 +00:00
parent b7e78028ce
commit a2308b9c99
2 changed files with 6 additions and 0 deletions

View File

@ -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