Opened 18 months ago

Closed 17 months ago

Last modified 17 months 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 17 months ago.
Added description of how to instantiate inline instances

Download all attachments as: .zip

Change History (8)

comment:1 Changed 18 months ago by timo

  • Component changed from contrib.admin to Documentation
  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Accepted
  • Type changed from Uncategorized to Cleanup/optimization

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

comment:2 Changed 17 months ago by avendael

  • Owner changed from nobody to avendael
  • Status changed from new to assigned

Changed 17 months ago by avendael

Added description of how to instantiate inline instances

comment:3 Changed 17 months 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 17 months 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 17 months ago by timo

  • Has patch set

comment:6 Changed 17 months ago by Tim Graham <timograham@…>

  • Resolution set to fixed
  • Status changed from assigned to closed

In 5a4f1298cf00fe4e2e35d0a3c02281b4c6afe07c:

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

Thanks matt at schinckel.net for the suggestion.

comment:7 Changed 17 months 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