summaryrefslogtreecommitdiff
path: root/docs/ref/applications.txt
diff options
context:
space:
mode:
authorAdam Johnson <me@adamj.eu>2020-01-22 12:45:22 +0000
committerCarlton Gibson <carlton@noumenal.es>2020-01-22 13:45:22 +0100
commit971a84d6af9de738be2a7a8344fa8c80671d1729 (patch)
tree3bc3b8ea1b316c2fbaf51deebc1a57ba9ad1a59b /docs/ref/applications.txt
parent486a8dae2d87e287ae24c9edda1abf0c3132af80 (diff)
Clarified AppConfig.ready() docs example.
Diffstat (limited to 'docs/ref/applications.txt')
-rw-r--r--docs/ref/applications.txt17
1 files changed, 11 insertions, 6 deletions
diff --git a/docs/ref/applications.txt b/docs/ref/applications.txt
index c5aa36144e..17b5615400 100644
--- a/docs/ref/applications.txt
+++ b/docs/ref/applications.txt
@@ -256,15 +256,20 @@ Methods
Example::
+ from django.apps import AppConfig
from django.db.models.signals import pre_save
- def ready(self):
- # importing model classes
- from .models import MyModel # or...
- MyModel = self.get_model('MyModel')
- # registering signals with the model's string label
- pre_save.connect(receiver, sender='app_label.MyModel')
+ class RockNRollConfig(AppConfig):
+ # ...
+
+ def ready(self):
+ # importing model classes
+ from .models import MyModel # or...
+ MyModel = self.get_model('MyModel')
+
+ # registering signals with the model's string label
+ pre_save.connect(receiver, sender='app_label.MyModel')
.. warning::