Deprecating Widget Media class

106 views
Skip to first unread message

Tim Graham

unread,
Apr 1, 2014, 2:32:15 PM4/1/14
to django-d...@googlegroups.com
There's been some discussion in ticket #22298 about deprecating the widget Media class. If this would make you particularly happy or sad, please leave your feedback on this thread or on the ticket.

Mark Lavin

unread,
Apr 1, 2014, 3:27:30 PM4/1/14
to django-d...@googlegroups.com
In my experience using the Media class is really only helpful in one place: the admin. If you have a third-party widget which requires CSS or JS is a pain to include it without the use of Media. Users want to just include the widget in the form class and have it "just work". A majority of the issues/questions I deal with on django-selectable are about how to get it working in the admin. Telling people to override and include it in the admin/base_site.html only seems adds confusion. It is documented how to override the admin templates but it would seem no one actually reads or understands them. In some cases they are trying to use apps which are already overriding it (like django-admin-tools). Outside the admin the Media class isn't nearly as helpful. It's easy enough to document adding the CSS/JS references in your base.html and users seem to understand that.

The biggest shortcoming of the Media class is summarized in https://code.djangoproject.com/ticket/12265. The order in which it is added isn't helpful nor well documented. I wouldn't complain too loudly if it was removed. It would be nice if it was replaced with another hook (possibly only in the admin) to improve the story for a third-party widget which requires some CSS/JS.

Best,

Mark
Reply all
Reply to author
Forward
0 new messages