Opened 16 years ago
Closed 16 years ago
#10128 closed (invalid)
widgets Media class has an initialisation error (maybe)
Reported by: | Peter Mott | Owned by: | nobody |
---|---|---|---|
Component: | Forms | Version: | 1.0 |
Severity: | Keywords: | Media widget initialise | |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
The django.forms.widgets Media instance can be initialised in two ways, either by supplying a dictionary of media arguments or by supplying an existing Media instance via the 'media' keyword. Django does not AFAICT use this second method at all. Anyway it does not work. The offending code:
if media: media_attrs = media.__dict__ else: media_attrs = kwargs
media.__dict__
gives a dictionary keyed by '_css' and '_js' whereas the subsequent code looks for 'css' and 'js' keys. Of course the (non-)role of the media keyword might be something else altogether in which case close the bug. Otherwise one could have media_attrs = {'css':media._css, 'js':media._js
} at line two or even change the attributes _css and _js to be the same as the MEDIA_TYPES.
Sorry this was my mistake.