mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-14 01:41:22 -06:00
#16971: Improve example in documentation
This commit is contained in:
parent
a24576f126
commit
64e56cd7c8
@ -87,14 +87,17 @@ class MyHousekeepingJob(JobRunner):
|
|||||||
|
|
||||||
def run(self, *args, **kwargs):
|
def run(self, *args, **kwargs):
|
||||||
MyModel.objects.filter(foo='bar').delete()
|
MyModel.objects.filter(foo='bar').delete()
|
||||||
|
|
||||||
system_jobs = (
|
|
||||||
MyHousekeepingJob,
|
|
||||||
)
|
|
||||||
```
|
```
|
||||||
|
|
||||||
!!! note
|
!!! 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
|
## Task queues
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user