mirror of
https://github.com/netbox-community/netbox.git
synced 2025-08-13 02:58:17 -06:00
15815 add logging
This commit is contained in:
parent
1a33692ae7
commit
3f0ad4063c
@ -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
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user