summaryrefslogtreecommitdiff
path: root/docs/ref
diff options
context:
space:
mode:
authorAymeric Augustin <aymeric.augustin@m4x.org>2013-12-28 14:41:11 +0100
committerAymeric Augustin <aymeric.augustin@m4x.org>2013-12-28 20:43:29 +0100
commit54790e669d73269bea6320c947ed8a46e98b8025 (patch)
treed1a543edc0f5ab904f66df3af7b883301562142d /docs/ref
parent81354b82bf647fd100e836dae2639e9c8d76c5eb (diff)
Simplified Apps.get_model and added AppConfig.get_model.
Documented them as public APIs.
Diffstat (limited to 'docs/ref')
-rw-r--r--docs/ref/applications.txt15
1 files changed, 15 insertions, 0 deletions
diff --git a/docs/ref/applications.txt b/docs/ref/applications.txt
index 15cc481f51..8f868f751e 100644
--- a/docs/ref/applications.txt
+++ b/docs/ref/applications.txt
@@ -153,6 +153,15 @@ Read-only attributes
It may be ``None`` if the application doesn't contain a ``models`` module.
+Methods
+-------
+
+.. method:: AppConfig.get_model(model_name)
+
+ Returns the :class:`~django.db.models.Model` with the given
+ ``model_name``. Raises :exc:`~exceptions.LookupError` if no such model
+ exists. ``model_name`` is case-insensitive.
+
Application registry
====================
@@ -189,3 +198,9 @@ Application registry
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.
+
+.. method:: apps.get_model(app_label, model_name)
+
+ Returns the :class:`~django.db.models.Model` with the given ``app_label``
+ and ``model_name``. Returns ``None`` if no such application or model
+ exists. ``model_name`` is case-insensitive.