Opened 15 years ago

Closed 15 years ago

Last modified 13 years ago

#12778 closed (fixed)

InlineAdmin ignores inner Media class

Reported by: Florian Apolloner Owned by: nobody
Component: contrib.admin Version: dev
Severity: Keywords:
Cc: Florian Apolloner Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

InlineAdmin ignores the Media class cause it inherits BaseModelAdmin. ModelAdmin has MediaDefiningClass as metaclass: http://code.djangoproject.com/browser/django/trunk/django/contrib/admin/options.py#L187 Imo it should get moved to BaseModelAdmin…

Attachments (1)

django-bug-12778.diff (4.1 KB ) - added by Paul McLanahan 15 years ago.
Proposed fix and tests

Download all attachments as: .zip

Change History (12)

comment:1 by Alex Gaynor, 15 years ago

Triage Stage: UnreviewedAccepted

comment:2 by Tobias McNulty, 15 years ago

Owner: changed from nobody to Tobias McNulty
Status: newassigned

comment:3 by Tobias McNulty, 15 years ago

Owner: changed from Tobias McNulty to nobody
Status: assignednew

comment:4 by Gonzalo Delgado, 15 years ago

I'm surely missing something, but I don't see a need for having a Media class in an InlineAdmin class since an instance's forms will be rendered in the same page of the AdminForm instance that contains it, and any media (CSS, Javascript) you want in that page should be included in your AdminForm class definition.

comment:5 by Florian Apolloner, 15 years ago

Might be, but then it should get documented. On the other hand it's nice to not override the form just to add a js/css file…

comment:6 by Gonzalo Delgado, 15 years ago

I see your point. I don't find overriding forms to add media annoying though (perhaps I don't do it quite often).

Maybe this should be discussed in django-developers?

comment:7 by Paul McLanahan, 15 years ago

Owner: changed from nobody to Paul McLanahan
Status: newassigned

by Paul McLanahan, 15 years ago

Attachment: django-bug-12778.diff added

Proposed fix and tests

comment:8 by Paul McLanahan, 15 years ago

Has patch: set
Owner: changed from Paul McLanahan to nobody
Status: assignednew

Added tests to check for the addition of admin media from combinations of ModelAdmin and InlineModelAdmin.
Moved assignment of forms.MediaDefiningClass metaclass to BaseModelAdmin.

comment:9 by Jannis Leidel, 15 years ago

Resolution: fixed
Status: newclosed

(In [12825]) Fixed #12778 - Added media handling abilities to admin inlines. Thanks for the patch, pmclanahan.

comment:10 by Jannis Leidel, 15 years ago

(In [12864]) [1.1.X] Fixed #12778 - Added media handling abilities to admin inlines. Thanks for the patch, pmclanahan.

Backport from trunk, r12825.

comment:11 by Jacob, 13 years ago

milestone: 1.2

Milestone 1.2 deleted

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