summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJacob Kaplan-Moss <jacob@jacobian.org>2009-04-10 17:10:44 +0000
committerJacob Kaplan-Moss <jacob@jacobian.org>2009-04-10 17:10:44 +0000
commitca5b624b05be5e9315cfd149afcd542b66279b4b (patch)
tree7f82e8e8712d3b4f8df497c6ad6fbdeed2323eca /tests
parent53af4523297ea1df783c045410fc36ea6520c46b (diff)
[1.0.X] Fixed #10774: accessing form media types in templates (i.e. ``{{ form.media.js }}``) now works. Thanks, tarequeh and Alex Gaynor. Backport of r10489 from trunk.
git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.0.X@10491 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'tests')
-rw-r--r--tests/regressiontests/forms/media.py14
1 files changed, 13 insertions, 1 deletions
diff --git a/tests/regressiontests/forms/media.py b/tests/regressiontests/forms/media.py
index d05db1f164..fc1b412bcf 100644
--- a/tests/regressiontests/forms/media.py
+++ b/tests/regressiontests/forms/media.py
@@ -355,5 +355,17 @@ media_tests = r"""
<script type="text/javascript" src="/path/to/js4"></script>
<script type="text/javascript" src="/some/form/javascript"></script>
+# Media works in templates
+>>> from django.template import Template, Context
+>>> Template("{{ form.media.js }}{{ form.media.css }}").render(Context({'form': f3}))
+u'<script type="text/javascript" src="/path/to/js1"></script>
+<script type="text/javascript" src="http://media.other.com/path/to/js2"></script>
+<script type="text/javascript" src="https://secure.other.com/path/to/js3"></script>
+<script type="text/javascript" src="/path/to/js4"></script>
+<script type="text/javascript" src="/some/form/javascript"></script><link href="http://media.example.com/media/path/to/css1" type="text/css" media="all" rel="stylesheet" />
+<link href="/path/to/css2" type="text/css" media="all" rel="stylesheet" />
+<link href="/path/to/css3" type="text/css" media="all" rel="stylesheet" />
+<link href="/some/form/css" type="text/css" media="all" rel="stylesheet" />'
+
>>> settings.MEDIA_URL = ORIGINAL_MEDIA_URL
-""" \ No newline at end of file
+"""