소스 검색

16867 render dashboard if model no longer available

Arthur Hanson 1 년 전
부모
커밋
2a8bec1cbf
1개의 변경된 파일4개의 추가작업 그리고 0개의 파일을 삭제
  1. 4 0
      netbox/extras/dashboard/widgets.py

+ 4 - 0
netbox/extras/dashboard/widgets.py

@@ -251,6 +251,10 @@ class ObjectListWidget(DashboardWidget):
     def render(self, request):
         app_label, model_name = self.config['model'].split('.')
         model = ObjectType.objects.get_by_natural_key(app_label, model_name).model_class()
+        if not model:
+            logger.debug(f"Dashboard Widget model_class not found: {app_label}:{model_name}")
+            return
+
         viewname = get_viewname(model, action='list')
 
         # Evaluate user's permission. Note that this controls only whether the HTMX element is