diff options
Diffstat (limited to 'docs/ref/applications.txt')
| -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:: |
