diff options
| author | Tim Graham <timograham@gmail.com> | 2014-03-03 10:40:06 -0500 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2014-03-03 10:42:32 -0500 |
| commit | e7649789eddeb2ce8f3bf8f69ddc624006d0a46c (patch) | |
| tree | 0775b12ae83339d10098c704e97d5a343b0251ce | |
| parent | 4aaea2921d7c98dd98fc99596239f8863cb312cc (diff) | |
[1.6.x] Fixed #21908 -- Added example usage for ModelAdmin.get_inline_instances().
Thanks matt at schinckel.net for the suggestion.
Backport of 5a4f1298cf from master
| -rw-r--r-- | docs/ref/contrib/admin/index.txt | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/docs/ref/contrib/admin/index.txt b/docs/ref/contrib/admin/index.txt index 33e6c578de..baa8f99886 100644 --- a/docs/ref/contrib/admin/index.txt +++ b/docs/ref/contrib/admin/index.txt @@ -1252,7 +1252,12 @@ 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): + def get_inline_instances(request, obj=None): + return [inline(self.model, self.admin_site) for inline in self.inlines] .. method:: ModelAdmin.get_urls() |
