Opened 15 years ago

Closed 15 years ago

Last modified 13 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: dev
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: no UI/UX: no

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 15 years ago.
Proposed fix for form media subtype access (via key) bug
template-media.diff (3.2 KB ) - added by Alex Gaynor 15 years ago.

Download all attachments as: .zip

Change History (7)

by Tareque Hossain, 15 years ago

Attachment: form_media_key_access.patch added

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

comment:1 by Alex Gaynor, 15 years ago

milestone: 1.1
Triage Stage: UnreviewedAccepted

comment:2 by Nowell Strite, 15 years ago

Has patch: set

by Alex Gaynor, 15 years ago

Attachment: template-media.diff added

comment:3 by Alex Gaynor, 15 years ago

Triage Stage: AcceptedReady for checkin

comment:4 by Jacob, 15 years ago

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 by Jacob, 13 years ago

milestone: 1.1

Milestone 1.1 deleted

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