mirror of
https://github.com/django/django.git
synced 2025-11-07 07:15:35 +00:00
Changed get_model to raise an exception on errors.
Returning None on errors required unpythonic error checking and was inconsistent with get_app_config. get_model was a private API until the previous commit, but given that it was certainly used in third party software, the change is explained in the release notes. Applied the same change to get_registered_model, which is a new private API introduced during the recent refactoring.
This commit is contained in:
@@ -602,9 +602,15 @@ in addition to application modules, you should review code that accesses this
|
||||
setting directly and use the app registry (:attr:`django.apps.apps`) instead.
|
||||
|
||||
The "app registry" that manages the list of installed applications doesn't
|
||||
have the same features as the old "app cache". However, even though the "app
|
||||
cache" was a private API, most of its methods were temporarily preserved and
|
||||
will go through a deprecation path.
|
||||
have the same features as the old "app cache". Even though the "app cache" was
|
||||
a private API, obsolete methods will be removed after a standard deprecation
|
||||
period. In addition, the following changes take effect immediately:
|
||||
|
||||
* ``get_model`` raises :exc:`~exceptions.LookupError` instead of returning
|
||||
``None`` when no model is found.
|
||||
|
||||
* The ``only_installed`` and ``seed_cache`` arguments of ``get_model`` no
|
||||
longer exist.
|
||||
|
||||
While the new implementation is believed to be more robust, regressions cannot
|
||||
be ruled out, especially during the import sequence. Circular imports that
|
||||
|
||||
Reference in New Issue
Block a user