Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#21908 closed Cleanup/optimization (fixed)

Misleading documentation in ModelAdmin.get_inline_instances

Reported by: matt@… Owned by: avendael
Component: Documentation Version: 1.6
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: yes UI/UX: no

Description

The documentation for this method seems a little sparse:

https://docs.djangoproject.com/en/dev/ref/contrib/admin/#django.contrib.admin.ModelAdmin.get_inline_instances

It's not actually clear that you need to instantiate the inline classes in this manner:

return [inline(self.model, self.admin_site) for inline in self.inlines]

(Obviously, that is without filtering).

I'm happy to submit a documentation patch, if it is likely to be accepted.

Attachments (1)

patch.diff (706 bytes) - added by avendael 3 years ago.
Added description of how to instantiate inline instances

Download all attachments as: .zip

Change History (8)

comment:1 Changed 3 years ago by Tim Graham

Component: contrib.adminDocumentation
Triage Stage: UnreviewedAccepted
Type: UncategorizedCleanup/optimization

Sure, I'll be happy to review your patch.

comment:2 Changed 3 years ago by avendael

Owner: changed from nobody to avendael
Status: newassigned

Changed 3 years ago by avendael

Attachment: patch.diff added

Added description of how to instantiate inline instances

comment:3 Changed 3 years ago by avendael

I'm not sure if my patch is good enough. It's my first time to contribute to django :)

comment:4 Changed 3 years ago by alextreme

Your patch is close, however fyi it uses a single colon where a double-colon should be used. A double colon indicates that the next block is a code sample.

comment:5 Changed 3 years ago by Tim Graham

Has patch: set

comment:6 Changed 3 years ago by Tim Graham <timograham@…>

Resolution: fixed
Status: assignedclosed

In 5a4f1298cf00fe4e2e35d0a3c02281b4c6afe07c:

Fixed #21908 -- Added example usage for ModelAdmin.get_inline_instances().

Thanks matt at schinckel.net for the suggestion.

comment:7 Changed 3 years ago by Tim Graham <timograham@…>

In e7649789eddeb2ce8f3bf8f69ddc624006d0a46c:

[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

Note: See TracTickets for help on using tickets.
Back to Top