Code

Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#13002 closed (fixed)

InlineModelAdmin 'form' option defaults to ModelForm, not BaseModelForm

Reported by: stijn@… Owned by: nobody
Component: Documentation Version: 1.1
Severity: Keywords:
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

While messing around a bit with admin customization, I noticed that the form option in an InlineModelAdmin actually defaults to ModelForm, and not BaseModelForm as the documentation mentions. Explicitly setting 'form' to BaseModelAdmin gives rise to assorted errors in the admin (e.g. "... has no attribute _meta ...") whereas setting it to ModelForm works without a hitch, which leads me to believe that there is no magic going on and that this is just a little factual error in the docs.

The specific doc page I'm talking about is this one: http://docs.djangoproject.com/en/dev/ref/contrib/admin/#form

Attachments (1)

13002.diff (487 bytes) - added by timo 4 years ago.

Download all attachments as: .zip

Change History (6)

comment:1 in reply to: ↑ description Changed 4 years ago by anonymous

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

Err, of course I meant "explicitly setting 'form' to BaseModelForm" and not "explicitly setting 'form' to BaseModelAdmin".

Replying to stijn@typograaf.be:

While messing around a bit with admin customization, I noticed that the form option in an InlineModelAdmin actually defaults to ModelForm, and not BaseModelForm as the documentation mentions. Explicitly setting 'form' to BaseModelAdmin gives rise to assorted errors in the admin (e.g. "... has no attribute _meta ...") whereas setting it to ModelForm works without a hitch, which leads me to believe that there is no magic going on and that this is just a little factual error in the docs.

The specific doc page I'm talking about is this one: http://docs.djangoproject.com/en/dev/ref/contrib/admin/#form

comment:2 Changed 4 years ago by russellm

  • Triage Stage changed from Unreviewed to Accepted

Changed 4 years ago by timo

comment:3 Changed 4 years ago by timo

  • Has patch set
  • Triage Stage changed from Accepted to Ready for checkin

comment:4 Changed 4 years ago by russellm

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

(In [13209]) Fixed #13002 -- Corrected description of the default form base class in InlineModelAdmin classes. Thanks to stijn@… for the report, and timo for the patch.

comment:5 Changed 4 years ago by russellm

(In [13214]) [1.1.X] Fixed #13002 -- Corrected description of the default form base class in InlineModelAdmin classes. Thanks to stijn@… for the report, and timo for the patch.

Backport of r13209 from trunk.

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.