1
0
mirror of https://github.com/django/django.git synced 2025-10-25 06:36:07 +00:00

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

git-svn-id: http://code.djangoproject.com/svn/django/trunk@10489 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Jacob Kaplan-Moss
2009-04-10 17:07:25 +00:00
parent fd443959df
commit 95f5e4a8da
2 changed files with 14 additions and 2 deletions

View File

@@ -75,7 +75,7 @@ class Media(StrAndUnicode):
def __getitem__(self, name):
"Returns a Media object that only contains media of the given type"
if name in MEDIA_TYPES:
return Media(**{name: getattr(self, '_' + name)})
return Media(**{str(name): getattr(self, '_' + name)})
raise KeyError('Unknown media type "%s"' % name)
def add_js(self, data):