Commit 17ffd24d authored by Simon Charette's avatar Simon Charette Committed by Tim Graham
Browse files

[1.5.x] Added warning about get_inline_instances() permission checking; refs #23754.

Backport of e0d1f268 from master
parent da3a23a4
Loading
Loading
Loading
Loading
+12 −1
Original line number Diff line number Diff line
@@ -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()