15815 add logging

This commit is contained in:
Arthur 2024-04-29 08:05:29 -07:00
parent 1a33692ae7
commit 3f0ad4063c

View File

@ -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)
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