Opened 10 years ago

Closed 10 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


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__
    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.

Change History (1)

comment:1 Changed 10 years ago by Peter Mott

Resolution: invalid
Status: newclosed

Sorry this was my mistake.

Note: See TracTickets for help on using tickets.
Back to Top