Skip to content

Commit ba75522

Browse files
authored
Improved docs for how to register dashboard widgets (#14913)
1 parent b9cac97 commit ba75522

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

docs/plugins/development/dashboard-widgets.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,3 +47,14 @@ class ReminderWidget(DashboardWidget):
4747
def render(self, request):
4848
return self.config.get('content')
4949
```
50+
51+
## Initialization
52+
53+
To register the widget, it becomes essential to import the widget module. The recommended approach is to accomplish this within the `ready` method situated in your `PluginConfig`:
54+
55+
```python
56+
class FooBarConfig(PluginConfig):
57+
def ready(self):
58+
super().ready()
59+
from . import widgets # point this to the above widget module you created
60+
```

0 commit comments

Comments
 (0)