#16971: Improve example in documentation

This commit is contained in:
Jeremy Stretch 2024-11-26 10:35:30 -05:00
parent a24576f126
commit 64e56cd7c8

View File

@ -87,14 +87,17 @@ class MyHousekeepingJob(JobRunner):
def run(self, *args, **kwargs):
MyModel.objects.filter(foo='bar').delete()
system_jobs = (
MyHousekeepingJob,
)
```
!!! note
Ensure that any system jobs are imported on initialization. Otherwise, they won't be registered. This can be achieved by extending the PluginConfig's `ready()` method.
Ensure that any system jobs are imported on initialization. Otherwise, they won't be registered. This can be achieved by extending the PluginConfig's `ready()` method. For example:
```python
def ready(self):
super().ready()
from .jobs import MyHousekeepingJob
```
## Task queues