Skip to content

Commit

Permalink
#16971: Improve example in documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremystretch committed Nov 26, 2024
1 parent a24576f commit 64e56cd
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions docs/plugins/development/background-jobs.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 64e56cd

Please sign in to comment.