summaryrefslogtreecommitdiff
path: root/docs/ref
diff options
context:
space:
mode:
authorHasan Ramezani <hasan.r67@gmail.com>2019-03-19 16:13:26 +0100
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2019-04-17 07:16:04 +0200
commit917fd9d03fdd21538864af4b412ac30b36d99268 (patch)
treeba9a1b26cac9b7a8c5f8258e00ac4f1832bef26a /docs/ref
parent7d49ad76562e8c0597a0eb66046ab423b12888d8 (diff)
Fixed #27755 -- Added ModelAdmin.get_inlines() hook.
Diffstat (limited to 'docs/ref')
-rw-r--r--docs/ref/contrib/admin/index.txt10
1 files changed, 10 insertions, 0 deletions
diff --git a/docs/ref/contrib/admin/index.txt b/docs/ref/contrib/admin/index.txt
index 93679c46fd..e6bb91cf5c 100644
--- a/docs/ref/contrib/admin/index.txt
+++ b/docs/ref/contrib/admin/index.txt
@@ -1627,6 +1627,16 @@ templates used by the :class:`ModelAdmin` views:
instances of the classes defined in :attr:`inlines` or you might encounter
a "Bad Request" error when adding related objects.
+.. method:: ModelAdmin.get_inlines(request, obj)
+
+ .. versionadded:: 3.0
+
+ The ``get_inlines`` method is given the ``HttpRequest`` and the
+ ``obj`` being edited (or ``None`` on an add form) and is expected to return
+ an iterable of inlines. You can override this method to dynamically add
+ inlines based on the request or model instance instead of specifying them
+ in :attr:`ModelAdmin.inlines`.
+
.. method:: ModelAdmin.get_urls()
The ``get_urls`` method on a ``ModelAdmin`` returns the URLs to be used for