From 917fd9d03fdd21538864af4b412ac30b36d99268 Mon Sep 17 00:00:00 2001 From: Hasan Ramezani Date: Tue, 19 Mar 2019 16:13:26 +0100 Subject: Fixed #27755 -- Added ModelAdmin.get_inlines() hook. --- docs/ref/contrib/admin/index.txt | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'docs/ref') 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 -- cgit v1.3