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

Fixes #7082: Avoid exception when referencing invalid content type in table

jeremystretch 4 лет назад
Родитель
Сommit
415313ac2f
2 измененных файлов с 5 добавлено и 0 удалено
  1. 1 0
      docs/release-notes/version-3.0.md
  2. 4 0
      netbox/utilities/tables.py

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

@@ -7,6 +7,7 @@
 * [#7070](https://github.com/netbox-community/netbox/issues/7070) - Fix exception when filtering by prefix max length in UI
 * [#7071](https://github.com/netbox-community/netbox/issues/7071) - Fix exception when removing a primary IP from a device/VM
 * [#7072](https://github.com/netbox-community/netbox/issues/7072) - Fix table configuration under prefix child object views
+* [#7082](https://github.com/netbox-community/netbox/issues/7082) - Avoid exception when referencing invalid content type in table
 * [#7083](https://github.com/netbox-community/netbox/issues/7083) - Correct labeling for VM memory attribute
 * [#7084](https://github.com/netbox-community/netbox/issues/7084) - Fix KeyError exception when editing access VLAN on an interface
 * [#7096](https://github.com/netbox-community/netbox/issues/7096) - Home links should honor `BASE_PATH` configuration

+ 4 - 0
netbox/utilities/tables.py

@@ -237,9 +237,13 @@ class ContentTypeColumn(tables.Column):
     Display a ContentType instance.
     """
     def render(self, value):
+        if value is None:
+            return None
         return content_type_name(value)
 
     def value(self, value):
+        if value is None:
+            return None
         return f"{value.app_label}.{value.model}"