diff options
| author | Simon Charette <charette.s@gmail.com> | 2014-11-25 13:13:45 -0500 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2014-11-25 13:15:58 -0500 |
| commit | 17ffd24d9b3528c5dcb0d50e86df2b03a9b288fc (patch) | |
| tree | 41922d7fa62c2c17241b392e03bd3ef67711b207 | |
| parent | da3a23a4dfff58a8b43e7607966b87550ad1b119 (diff) | |
[1.5.x] Added warning about get_inline_instances() permission checking; refs #23754.
Backport of e0d1f2684ae60573b209783f9fd4f9db163ad704 from master
| -rw-r--r-- | docs/ref/contrib/admin/index.txt | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/docs/ref/contrib/admin/index.txt b/docs/ref/contrib/admin/index.txt index 25cb1ea158..0434bb1b9a 100644 --- a/docs/ref/contrib/admin/index.txt +++ b/docs/ref/contrib/admin/index.txt @@ -1128,7 +1128,18 @@ templates used by the :class:`ModelAdmin` views: ``obj`` being edited (or ``None`` on an add form) and is expected to return a ``list`` or ``tuple`` of :class:`~django.contrib.admin.InlineModelAdmin` objects, as described below in the :class:`~django.contrib.admin.InlineModelAdmin` - section. + section. For example, the following would return inlines without the default + filtering based on add, change, and delete permissions:: + + class MyModelAdmin(admin.ModelAdmin): + inlines = (MyInline,) + + def get_inline_instances(self, request, obj=None): + return [inline(self.model, self.admin_site) for inline in self.inlines] + + If you override this method, make sure that the returned inlines are + instances of the classes defined in :attr:`inlines` or you might encounter + a "Bad Request" error when adding related objects. .. method:: ModelAdmin.get_urls() |
