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 4dcbde76fc
commit 35995967f9
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