diff options
| author | Adam Johnson <me@adamj.eu> | 2020-01-22 12:45:22 +0000 |
|---|---|---|
| committer | Carlton Gibson <carlton.gibson@noumenal.es> | 2020-01-22 13:52:23 +0100 |
| commit | ef22cf41af092d598208b4d373fe40403c2366dd (patch) | |
| tree | 32d4e2b5521b5892e9a64d3f9f1adbb3630f0a12 | |
| parent | a56e45a2bfc75116451c4e24fce82aa1827edb11 (diff) | |
[3.0.x] Clarified AppConfig.ready() docs example.
Backport of 971a84d6af9de738be2a7a8344fa8c80671d1729 from master
| -rw-r--r-- | docs/ref/applications.txt | 17 |
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:: |
