소스 검색

#16971: Improve example in documentation

Jeremy Stretch 1 년 전
부모
커밋
64e56cd7c8
1개의 변경된 파일8개의 추가작업 그리고 5개의 파일을 삭제
  1. 8 5
      docs/plugins/development/background-jobs.md

+ 8 - 5
docs/plugins/development/background-jobs.md

@@ -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