diff options
| author | Aymeric Augustin <aymeric.augustin@m4x.org> | 2013-12-25 21:57:52 +0100 |
|---|---|---|
| committer | Aymeric Augustin <aymeric.augustin@m4x.org> | 2013-12-25 21:57:52 +0100 |
| commit | 7df049c417e7d1e538755a7010c57c71ca9d5b5e (patch) | |
| tree | 631c10eecf9f93a507a18c6f71613db7feff2684 /docs | |
| parent | 08bb238eae8f40df103441b067818ecc72fe51b8 (diff) | |
Swapped app registry and app config API docs.
Thanks David Larlet for the suggestion.
Also fixed some Sphinx warnings and improved ReST markup.
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/ref/applications.txt | 88 | ||||
| -rw-r--r-- | docs/ref/settings.txt | 2 |
2 files changed, 45 insertions, 45 deletions
diff --git a/docs/ref/applications.txt b/docs/ref/applications.txt index 5d13d0d4d8..a675d55a9d 100644 --- a/docs/ref/applications.txt +++ b/docs/ref/applications.txt @@ -102,47 +102,10 @@ configuration:: Again, defining project-specific configuration classes in a submodule called ``apps`` is a convention, not a requirement. -Application registry -==================== - -.. data:: django.apps.apps - - The application registry provides the following public API. Methods that - aren't listed below are considered private and may change without notice. - -.. method:: django.apps.apps.ready() - - Returns ``True`` if the registry is fully populated. - -.. method:: django.apps.apps.get_app_configs(only_with_models_module=False) - - Returns an iterable of :class:`~django.apps.AppConfig` instances. - - If only applications containing a models module are of interest, this method - can be called with ``only_with_models_module=True``. - -.. method:: django.apps.apps.get_app_config(app_label, only_with_models_module=False) - - Returns an :class:`~django.apps.AppConfig` for the application with the - given ``app_label``. Raises :exc:`~exceptions.LookupError` if no such - application exists. - - If only applications containing a models module are of interest, this method - can be called with ``only_with_models_module=True``. - -.. method:: django.apps.apps.has_app(app_name) - - Checks whether an application with the given name exists in the registry. - ``app_name`` is the full name of the app, e.g. 'django.contrib.admin'. - - Unlike :meth:`~django.apps.apps.get_app_config`, this method can be called - safely at import time. If the registry is still being populated, it may - return ``False``, even though the app will become available later. - Application configuration ========================= -.. class:: django.apps.AppConfig +.. class:: AppConfig Application configuration objects store metadata for an application. Some attributes can be configured in :class:`~django.apps.AppConfig` @@ -151,7 +114,7 @@ Application configuration Configurable attributes ----------------------- -.. data:: django.apps.AppConfig.verbose_name +.. attribute:: AppConfig.verbose_name Human-readable name for the application, e.g. "Admin". @@ -160,17 +123,17 @@ Configurable attributes Read-only attributes -------------------- -.. data:: django.apps.AppConfig.name +.. attribute:: AppConfig.name Full Python path to the application, e.g. ``'django.contrib.admin'``. -.. data:: django.apps.AppConfig.label +.. attribute:: AppConfig.label Last component of the Python path to the application, e.g. ``'admin'``. This value must be unique across a Django project. -.. data:: django.apps.AppConfig.path +.. attribute:: AppConfig.path Filesystem path to the application directory, e.g. ``'/usr/lib/python2.7/dist-packages/django/contrib/admin'``. @@ -178,14 +141,51 @@ Read-only attributes It may be ``None`` if the application isn't stored in a directory, for instance if it's loaded from an egg. -.. data:: django.apps.AppConfig.app_module +.. attribute:: AppConfig.app_module Root module for the application, e.g. ``<module 'django.contrib.admin' from 'django/contrib/admin/__init__.pyc'>``. -.. data:: django.apps.AppConfig.models_module +.. attribute:: AppConfig.models_module Module containing the models, e.g. ``<module 'django.contrib.admin.models' from 'django/contrib/admin/models.pyc'>``. It may be ``None`` if the application doesn't contain a ``models`` module. + +Application registry +==================== + +.. data:: apps + + The application registry provides the following public API. Methods that + aren't listed below are considered private and may change without notice. + +.. method:: apps.ready() + + Returns ``True`` if the registry is fully populated. + +.. method:: apps.get_app_configs(only_with_models_module=False) + + Returns an iterable of :class:`~django.apps.AppConfig` instances. + + If only applications containing a models module are of interest, this method + can be called with ``only_with_models_module=True``. + +.. method:: apps.get_app_config(app_label, only_with_models_module=False) + + Returns an :class:`~django.apps.AppConfig` for the application with the + given ``app_label``. Raises :exc:`~exceptions.LookupError` if no such + application exists. + + If only applications containing a models module are of interest, this method + can be called with ``only_with_models_module=True``. + +.. method:: apps.has_app(app_name) + + Checks whether an application with the given name exists in the registry. + ``app_name`` is the full name of the app, e.g. 'django.contrib.admin'. + + Unlike :meth:`~django.apps.apps.get_app_config`, this method can be called + safely at import time. If the registry is still being populated, it may + return ``False``, even though the app will become available later. diff --git a/docs/ref/settings.txt b/docs/ref/settings.txt index e9b98fb711..e4dfa7fbfe 100644 --- a/docs/ref/settings.txt +++ b/docs/ref/settings.txt @@ -1288,7 +1288,7 @@ Default: ``()`` (Empty tuple) A tuple of strings designating all applications that are enabled in this Django installation. Each string should be a full Python path to an application configuration class or to a Python package containing a -application. :ref:` Learn more about applications </ref/applications>`. +application. :doc:`Learn more about applications </ref/applications>`. .. versionchanged:: 1.7 |
