From ef22cf41af092d598208b4d373fe40403c2366dd Mon Sep 17 00:00:00 2001 From: Adam Johnson Date: Wed, 22 Jan 2020 12:45:22 +0000 Subject: [PATCH] [3.0.x] Clarified AppConfig.ready() docs example. Backport of 971a84d6af9de738be2a7a8344fa8c80671d1729 from master --- docs/ref/applications.txt | 17 +++++++++++------ 1 file 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::