mirror of
https://github.com/django/django.git
synced 2025-08-03 10:34:04 +00:00
Modified readiness check in AppConfig.get_model(s).
It was inconsistent with the equivalent check in Apps.get_model(s) because I made incorrect assumptions when I wrote that code and needlessly complicated readiness checks. This is a backwards-incompatible change.
This commit is contained in:
parent
20be1918e7
commit
efcb7e1ebf
5 changed files with 30 additions and 13 deletions
|
@ -227,11 +227,16 @@ Methods
|
|||
Returns an iterable of :class:`~django.db.models.Model` classes for this
|
||||
application.
|
||||
|
||||
Requires the app registry to be fully populated.
|
||||
|
||||
.. method:: AppConfig.get_model(model_name)
|
||||
|
||||
Returns the :class:`~django.db.models.Model` with the given
|
||||
``model_name``. Raises :exc:`LookupError` if no such model exists in this
|
||||
application. ``model_name`` is case-insensitive.
|
||||
``model_name``. ``model_name`` is case-insensitive.
|
||||
|
||||
Raises :exc:`LookupError` if no such model exists in this application.
|
||||
|
||||
Requires the app registry to be fully populated.
|
||||
|
||||
.. method:: AppConfig.ready()
|
||||
|
||||
|
|
|
@ -579,6 +579,13 @@ Miscellaneous
|
|||
* ``ConditionalGetMiddleware`` no longer sets the ``Date`` header as Web
|
||||
servers set that header.
|
||||
|
||||
* :meth:`~django.apps.AppConfig.get_model` and
|
||||
:meth:`~django.apps.AppConfig.get_models` now raise
|
||||
:exc:`~django.core.exceptions.AppRegistryNotReady` if they're called before
|
||||
models of all applications have been loaded. Previously they only required
|
||||
the target application's models to be loaded and thus could return models
|
||||
without all their relations set up.
|
||||
|
||||
.. _deprecated-features-1.11:
|
||||
|
||||
Features deprecated in 1.11
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue