﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
21987	Allow Media objects to have their own MEDIA_TYPES	Keryn Knight <django@…>	Michael Kelly	"Currently, [https://github.com/django/django/blob/a2814846ca006b4fbf3a893ec52cd9d444b3a3eb/django/forms/widgets.py#L35 instances of Media] look to the module scope to get the known [https://github.com/django/django/blob/a2814846ca006b4fbf3a893ec52cd9d444b3a3eb/django/forms/widgets.py#L31 MEDIA_TYPES]. This makes it difficult to subclass `Media` to add extra `render_x`/`add_x` methods because `MEDIA_TYPES` is hardcoded in [https://github.com/django/django/blob/a2814846ca006b4fbf3a893ec52cd9d444b3a3eb/django/forms/widgets.py#L45 __init__], [https://github.com/django/django/blob/a2814846ca006b4fbf3a893ec52cd9d444b3a3eb/django/forms/widgets.py#L56 render], [https://github.com/django/django/blob/a2814846ca006b4fbf3a893ec52cd9d444b3a3eb/django/forms/widgets.py#L83 __getitem__] and [https://github.com/django/django/blob/a2814846ca006b4fbf3a893ec52cd9d444b3a3eb/django/forms/widgets.py#L102 __add__] and isn't easily available for a subclass to add to without monkeypatching the module constant. As far as I can tell, the only use of `MEDIA_TYPES` is in the widgets module, and could be shifted to the class itself, leaving the module level one to raise a deprecation warning.

Rationale is that I want to be able to add `inline_css` and `inline_js`, or `text` (for JS templates etc) to a `Media` object, and currently that's more difficult than just adjusting a subclass' attribute and adding the appropriate methods."	Cleanup/optimization	assigned	Forms	dev	Normal			hirokiky@…	Accepted	1	0	0	1	0	0
