Opened 6 years ago

Closed 6 years ago

Last modified 3 years ago

#10774 closed (fixed)

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

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

Download all attachments as: .zip

Change History (7)

Changed 6 years ago by tarequeh

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

comment:1 Changed 6 years ago by Alex

  • milestone set to 1.1
  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Accepted

comment:2 Changed 6 years ago by nbstrite

  • Has patch set

Changed 6 years ago by Alex

comment:3 Changed 6 years ago by Alex

  • Triage Stage changed from Accepted to Ready for checkin

comment:4 Changed 6 years ago by jacob

  • Resolution set to fixed
  • Status changed from new to closed

(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 3 years ago by jacob

  • milestone 1.1 deleted

Milestone 1.1 deleted

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