Browse Source

Set the private pk after super save

Saria Hajjar 6 years ago
parent
commit
608006ee77
1 changed files with 3 additions and 0 deletions
  1. 3 0
      netbox/dcim/models.py

+ 3 - 0
netbox/dcim/models.py

@@ -3141,6 +3141,9 @@ class Cable(ChangeLoggedModel):
 
         super().save(*args, **kwargs)
 
+        # Update the private pk used in __str__ in case this is a new object (i.e. just got its pk)
+        self._pk = self.pk
+
     def to_csv(self):
         return (
             '{}.{}'.format(self.termination_a_type.app_label, self.termination_a_type.model),