Opened 8 years ago

Closed 8 years ago

Last modified 5 years ago

#10774 closed (fixed)

Accessing form media subtypes ('js', 'css') in templates does not work

Reported by: Tareque Hossain Owned by: nobody
Component: Forms Version: master
Severity: Keywords: form media typeerror
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

Accessing form.media.js or form.media.css from templates does not work because the keys ('js', 'css') gets passed in as unicode strings. The __getitem__ function for django form widget Media object defined here raises TypeError: '__init__() keywords must be strings' whenever name variable is a unicode string.

Attachments (2)

form_media_key_access.patch (569 bytes) - added by Tareque Hossain 8 years ago.
Proposed fix for form media subtype access (via key) bug
template-media.diff (3.2 KB) - added by Alex Gaynor 8 years ago.

Download all attachments as: .zip

Change History (7)

Changed 8 years ago by Tareque Hossain

Attachment: form_media_key_access.patch added

Proposed fix for form media subtype access (via key) bug

comment:1 Changed 8 years ago by Alex Gaynor

milestone: 1.1
Triage Stage: UnreviewedAccepted

comment:2 Changed 8 years ago by Nowell Strite

Has patch: set

Changed 8 years ago by Alex Gaynor

Attachment: template-media.diff added

comment:3 Changed 8 years ago by Alex Gaynor

Triage Stage: AcceptedReady for checkin

comment:4 Changed 8 years ago by Jacob

Resolution: fixed
Status: newclosed

(In [10489]) Fixed #10774: accessing form media types in templates (i.e. {{ form.media.js }}) now works. Thanks, tarequeh and Alex Gaynor.

comment:5 Changed 5 years ago by Jacob

milestone: 1.1

Milestone 1.1 deleted

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