[3.0.x] Clarified AppConfig.ready() docs example.

Backport of 971a84d6af from master
This commit is contained in:
Adam Johnson 2020-01-22 12:45:22 +00:00 committed by Carlton Gibson
parent a56e45a2bf
commit ef22cf41af
1 changed files with 11 additions and 6 deletions

View File

@ -256,15 +256,20 @@ Methods
Example:: Example::
from django.apps import AppConfig
from django.db.models.signals import pre_save 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 class RockNRollConfig(AppConfig):
pre_save.connect(receiver, sender='app_label.MyModel') # ...
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:: .. warning::