|
3 | 3 | """ |
4 | 4 |
|
5 | 5 | from django.apps import AppConfig |
6 | | -from edx_django_utils.plugins.constants import PluginSettings, PluginSignals, PluginURLs |
| 6 | +from edx_django_utils.plugins.constants import PluginSettings, PluginURLs |
7 | 7 |
|
8 | 8 |
|
9 | 9 | class SamplePluginConfig(AppConfig): |
10 | 10 | # pylint: disable=line-too-long |
11 | 11 | """ |
12 | | - Configuration for the sample_plugin Django application. |
| 12 | + Configuration for the sample_plugin Django application as an edx-platform plugin |
13 | 13 |
|
14 | | - See https://github.com/openedx/edx-django-utils/blob/master/edx_django_utils/plugins/docs/how_tos/how_to_create_a_plugin_app.rst#manual-setup |
| 14 | + See https://docs.openedx.org/projects/edx-django-utils/en/latest/plugins/how_tos/how_to_create_a_plugin_app.html#manual-setup |
15 | 15 | for more details and examples. |
16 | 16 | """ # noqa: |
17 | 17 |
|
@@ -54,18 +54,21 @@ class SamplePluginConfig(AppConfig): |
54 | 54 | }, |
55 | 55 | }, |
56 | 56 | }, |
57 | | - PluginSignals.CONFIG: { |
58 | | - "lms.djangoapp": { |
59 | | - PluginURLs.RELATIVE_PATH: "signals", |
60 | | - PluginSignals.RECEIVERS: [ |
61 | | - # Signals handlers can be registered here |
62 | | - ], |
63 | | - }, |
64 | | - "cms.djangoapp": { |
65 | | - PluginURLs.RELATIVE_PATH: "signals", |
66 | | - PluginSignals.RECEIVERS: [ |
67 | | - # Signals handlers can be registered here |
68 | | - ], |
69 | | - }, |
70 | | - }, |
| 57 | + # You could also define PluginSignals.CONFIG here as a part of this block |
| 58 | + # and define all our openedx-events connections here explicitly. However, |
| 59 | + # it's much easier to just put all your signal recievers in one file and import |
| 60 | + # that file below as a par of the ready() function. |
| 61 | + # |
| 62 | + # Docs for using PluginSignals can be found here: |
| 63 | + # https://docs.openedx.org/projects/edx-django-utils/en/latest/plugins/how_tos/how_to_create_a_plugin_app.html |
71 | 64 | } |
| 65 | + |
| 66 | + def ready(self): |
| 67 | + """ |
| 68 | + Do any app specific loading that needs to happen. |
| 69 | + """ |
| 70 | + |
| 71 | + # Import the handlers file so that our signal recievers |
| 72 | + # get registered and can run when the relevant signals get |
| 73 | + # fired. |
| 74 | + from . import signals |
0 commit comments