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

This commit is contained in:
jeremystretch 2021-08-31 11:43:44 -04:00
parent 7db2b9d091
commit 415313ac2f
2 changed files with 5 additions and 0 deletions

View File

@ -7,6 +7,7 @@
* [#7070](https://github.com/netbox-community/netbox/issues/7070) - Fix exception when filtering by prefix max length in UI * [#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 * [#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 * [#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 * [#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 * [#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 * [#7096](https://github.com/netbox-community/netbox/issues/7096) - Home links should honor `BASE_PATH` configuration

View File

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