#26616: Documentation: Improve description of AppConfig.ready()
-------------------------------------+-------------------------------------
Reporter: marfire | Owner: nobody
Type: | Status: new
Cleanup/optimization |
Component: Documentation | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by marfire):
Since the point about not importing models at import time is made
forcefully and in detail in '''How applications are loaded''', I think
this would work:
Subclasses can override this method to perform initialization tasks such
as registering signals. It is called as soon as the registry is fully
populated.
This is the first point in the application loading process where it's
safe for you to import models (see How applications are loaded[link] for
more details). You can do so with a regular `import` statement or by using
`get_model()` to access a model class by name, like this:
Or something like that. To me the main thing is to make clear that the
distinction is between importing models at import time versus in
`ready()`, not between `get_model()` and `import`.
--
Ticket URL: <https://code.djangoproject.com/ticket/26616#comment:2>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/065.a1daa053892bc2676fb8cde95c2ef29f%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.