Code

Opened 5 years ago

Closed 19 months ago

#11584 closed Cleanup/optimization (wontfix)

Clarify InlineModelAdmin documentation

Reported by: josePhoenix Owned by: nobody
Component: Documentation Version: 1.0
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

I was just stuck for hours with InlineModelAdmins. I don't often blame the docs, but in this case I genuinely believe they can be made better. I assumed, from the line on http://docs.djangoproject.com/en/dev/ref/contrib/admin/#inlinemodeladmin-options saying "The InlineModelAdmin class is a subclass of ModelAdmin so it inherits all the same functionality as well as some of its own:
" that I was supposed to use admin.site.register() to register my InlineModelAdmin classes as I would a normal ModelAdmin class. As I later learned, defining 'model = ' on the InlineModelAdmin makes registering unnecessary. Ideally, the fact that InlineModelAdmins need not be registered would be noted either at the top of the InlineModelAdmin section or perhaps as an explanatory addition to http://docs.djangoproject.com/en/dev/ref/contrib/admin/#model

Hopefully this will save others some trouble!

(In a separate but related note, the exceptions and behavior one gets when mistakenly admin.site.register()ing an InlineModelAdmin class are completely mystifying. I don't know what the Django policy is for when it's prudent to add checks and exceptions for improper configuration, but one there would have saved me a lot of head-scratching)

Attachments (0)

Change History (5)

comment:1 Changed 5 years ago by Alex

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Accepted

comment:2 Changed 3 years ago by julien

  • Severity set to Normal
  • Type set to Cleanup/optimization

comment:3 Changed 2 years ago by aaugustin

  • UI/UX unset

Change UI/UX from NULL to False.

comment:4 Changed 2 years ago by aaugustin

  • Easy pickings unset

Change Easy pickings from NULL to False.

comment:5 Changed 19 months ago by timo

  • Resolution set to wontfix
  • Status changed from new to closed

I think the docs are fairly explicit in usage: "You add inlines to a model by specifying them in a ModelAdmin.inlines". There's no mention of using admin.site.register() so I don't think this is worth it.

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.