Skip to content

Commit c3a40af

Browse files
charettestimgraham
authored andcommitted
[1.6.x] Added warning about get_inline_instances() permission checking; refs #23754.
Backport of e0d1f26 from master
1 parent 3c31706 commit c3a40af

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

docs/ref/contrib/admin/index.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1261,9 +1261,15 @@ templates used by the :class:`ModelAdmin` views:
12611261
filtering based on add, change, and delete permissions::
12621262

12631263
class MyModelAdmin(admin.ModelAdmin):
1264+
inlines = (MyInline,)
1265+
12641266
def get_inline_instances(self, request, obj=None):
12651267
return [inline(self.model, self.admin_site) for inline in self.inlines]
12661268

1269+
If you override this method, make sure that the returned inlines are
1270+
instances of the classes defined in :attr:`inlines` or you might encounter
1271+
a "Bad Request" error when adding related objects.
1272+
12671273
.. method:: ModelAdmin.get_urls()
12681274

12691275
The ``get_urls`` method on a ``ModelAdmin`` returns the URLs to be used for

0 commit comments

Comments
 (0)