Просмотр исходного кода

Fixes #5453: Correct change log representation when creating a cable

Jeremy Stretch 5 лет назад
Родитель
Сommit
67f9e16905
2 измененных файлов с 6 добавлено и 2 удалено
  1. 4 1
      docs/release-notes/version-2.10.md
  2. 2 1
      netbox/dcim/models/cables.py

+ 4 - 1
docs/release-notes/version-2.10.md

@@ -1,13 +1,16 @@
 # NetBox v2.10
 
-## v2.10.1 (Future Release)
+## v2.10.1 (FUTURE)
 
 ### Bug Fixes
 
+* [#5453](https://github.com/netbox-community/netbox/issues/5453) - Correct change log representation when creating a cable
 * [#5458](https://github.com/netbox-community/netbox/issues/5458) - Creating a component template throws an exception
 * [#5461](https://github.com/netbox-community/netbox/issues/5461) - Rack Elevations throw reverse match exception
 * [#5463](https://github.com/netbox-community/netbox/issues/5463) - Back-to-back Circuit Termination throws AttributeError exception
 
+---
+
 ## v2.10.0 (2020-12-14)
 
 **NOTE:** This release completely removes support for embedded graphs.

+ 2 - 1
netbox/dcim/models/cables.py

@@ -147,7 +147,8 @@ class Cable(ChangeLoggedModel, CustomFieldModel):
         return instance
 
     def __str__(self):
-        return self.label or '#{}'.format(self._pk)
+        pk = self.pk or self._pk
+        return self.label or f'#{pk}'
 
     def get_absolute_url(self):
         return reverse('dcim:cable', args=[self.pk])