django_evolution.compat.apps
Compatibility functions for the application registration.
This provides functions for app registration and lookup. These functions translate to the various versions of Django that are supported.
Functions
Clear the Django app/models caches. |
|
|
Return the app with the given label. |
|
Return the list of all installed apps with models. |
|
Return whether the app registry is tracking a given app. |
|
Register a new app in the registry. |
|
Register one or more models to a given app. |
|
Unregister an app in the registry. |
|
Unregister a model with the given name from the given app. |
- django_evolution.compat.apps.clear_app_cache()
Clear the Django app/models caches.
This cache is used in Django >= 1.2 to quickly return results when fetching models. It needs to be cleared when modifying the model registry.
- django_evolution.compat.apps.get_app(app_label, emptyOK=False)
Return the app with the given label.
This returns the app from the app registry on Django >= 1.7, and from the old-style cache on Django < 1.7.
- app_label (str):
The label for the app containing the models.
- emptyOK (bool, optional):
Impacts the return value if the app has no models in it.
- Returns:
The app module, if available.
If the app module is available, but the models module is not and
emptyOK
is set, this will returnNone
. Otherwise, if modules are not available, this will raiseImproperlyConfigured
.- Return type:
module
- Raises:
django.core.exceptions.ImproperlyConfigured – The app module was not found, or it was found but a models module was not and
emptyOK
wasFalse
.