From 3f0ad4063c15e8081b5c25115f2ce685496766d3 Mon Sep 17 00:00:00 2001 From: Arthur Date: Mon, 29 Apr 2024 08:05:29 -0700 Subject: [PATCH] 15815 add logging --- netbox/extras/dashboard/widgets.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/netbox/extras/dashboard/widgets.py b/netbox/extras/dashboard/widgets.py index 89bc1f0bb..a3d7f05a3 100644 --- a/netbox/extras/dashboard/widgets.py +++ b/netbox/extras/dashboard/widgets.py @@ -1,3 +1,4 @@ +import logging import uuid from functools import cached_property from hashlib import sha256 @@ -32,6 +33,8 @@ __all__ = ( 'WidgetConfigForm', ) +logger = logging.getLogger('netbox.data_backends') + def get_object_type_choices(): return [ @@ -56,9 +59,13 @@ def get_models_from_content_types(content_types): app_label, model_name = content_type_id.split('.') try: content_type = ObjectType.objects.get_by_natural_key(app_label, model_name) - models.append(content_type.model_class()) + if content_type.model_class(): + models.append(content_type.model_class()) + else: + logger.debug(f"Dashboard Widget model_class not found: {app_label}:{model_name}") except ObjectType.DoesNotExist: - pass + logger.debug(f"Dashboard Widget ObjectType not found: {app_label}:{model_name}") + return models