mirror of
https://github.com/django/django.git
synced 2025-07-24 05:36:15 +00:00
Fixed #21908 -- Added example usage for ModelAdmin.get_inline_instances().
Thanks matt at schinckel.net for the suggestion.
This commit is contained in:
parent
0dffaf9c25
commit
5a4f1298cf
1 changed files with 6 additions and 1 deletions
|
@ -1393,7 +1393,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()
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue