#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)
Change History (12)
comment:1 by , 16 years ago
| Triage Stage: | Unreviewed → Accepted |
|---|
comment:2 by , 16 years ago
| Owner: | changed from to |
|---|---|
| Status: | new → assigned |
comment:3 by , 16 years ago
| Owner: | changed from to |
|---|---|
| Status: | assigned → new |
comment:4 by , 16 years ago
comment:5 by , 16 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 , 16 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 , 16 years ago
| Owner: | changed from to |
|---|---|
| Status: | new → assigned |
comment:8 by , 16 years ago
| Has patch: | set |
|---|---|
| Owner: | changed from to |
| Status: | assigned → new |
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 , 16 years ago
| Resolution: | → fixed |
|---|---|
| Status: | new → closed |
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.