#36538: Addition of `AdminSite.media` for adding JS and CSS files globally to every admin page -------------------------------------+------------------------------------- Reporter: MichaĆ Pokusa | Type: New | feature Status: new | Component: | contrib.admin Version: dev | Severity: Normal Keywords: admin adminsite | Triage Stage: media script style global | Unreviewed Has patch: 0 | Needs documentation: 0 Needs tests: 0 | Patch needs improvement: 0 Easy pickings: 0 | UI/UX: 0 -------------------------------------+------------------------------------- I propose adding the property `media` to `AdminSite` class, with similar functionality as `ModelAdmin.media`. The main reason for it is making it easy to add any JS/CSS globally for every admin page, and it will make the media management more consistent across the admin.
While it is possible to do that now by extending one of the base templates and manually adding the script or link tag, the main benefit will be the ability to separate this from the templates completely and in future, maybe moving all hard-coded media html tags to `AdminSite.media` thus making the template cleaner and making it possible to take advantage of `Media` merging logic. Instalation of packages that add custom styles or scripts would be simplified, and be as easy as inheriting from a admin site mixin: {{{#!python class CustomAdminSite(PackageMixin, AdminSite) ... }}} Implementation would require adding the `AdminSite.media` property and small modification to the `admin/base.html` template. If this issue is accepted, I would be happy to take on it. -- Ticket URL: <https://code.djangoproject.com/ticket/36538> Django <https://code.djangoproject.com/> The Web framework for perfectionists with deadlines. -- You received this message because you are subscribed to the Google Groups "Django updates" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-updates+unsubscr...@googlegroups.com. To view this discussion visit https://groups.google.com/d/msgid/django-updates/01070198662499bd-3231bd40-c024-48a5-8c62-7c191e601715-000000%40eu-central-1.amazonses.com.