Przeglądaj źródła

Fixes #12106: Fix exception when saving dashboard widget with minimum width/height

jeremystretch 2 lat temu
rodzic
commit
eb77c0e920

+ 1 - 0
docs/release-notes/version-3.5.md

@@ -70,6 +70,7 @@ Two new webhook trigger events have been introduced: `job_start` and `job_end`.
 
 
 ### Bug Fixes (From Beta1)
 ### Bug Fixes (From Beta1)
 
 
+* [#12106](https://github.com/netbox-community/netbox/issues/12106) - Fix exception when saving dashboard widget with minimum width/height
 * [#12108](https://github.com/netbox-community/netbox/issues/12108) - Limit the draggable area of widgets to their headers
 * [#12108](https://github.com/netbox-community/netbox/issues/12108) - Limit the draggable area of widgets to their headers
 * [#12109](https://github.com/netbox-community/netbox/issues/12109) - Fix migration error when replicating more than 100 job results
 * [#12109](https://github.com/netbox-community/netbox/issues/12109) - Fix migration error when replicating more than 100 job results
 * [#12112](https://github.com/netbox-community/netbox/issues/12112) - Do not link data source URL for local paths
 * [#12112](https://github.com/netbox-community/netbox/issues/12112) - Do not link data source URL for local paths

+ 2 - 2
netbox/extras/dashboard/widgets.py

@@ -58,8 +58,8 @@ class DashboardWidget:
         return self.title or self.__class__.__name__
         return self.title or self.__class__.__name__
 
 
     def set_layout(self, grid_item):
     def set_layout(self, grid_item):
-        self.width = grid_item['w']
-        self.height = grid_item['h']
+        self.width = grid_item.get('w', 1)
+        self.height = grid_item.get('h', 1)
         self.x = grid_item.get('x')
         self.x = grid_item.get('x')
         self.y = grid_item.get('y')
         self.y = grid_item.get('y')