Created
December 10, 2013 06:10
-
-
Save CapnKernel/7886376 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from django.shortcuts import render | |
| from django.template import Template, RequestContext | |
| from django.http import HttpResponse | |
| def view(request): | |
| nds = { | |
| u'outer1': ('mid1a', 'mid1b'), | |
| u'outer2': ('mid2a', ), | |
| } | |
| ts = u"""<pre> | |
| nds={{ nds }}. | |
| {% for outerk, outerv in nds.items %} | |
| outerk={{ outerk }} outerv={{ outerv }} | |
| {% for mid in outerv %} | |
| mid={{ mid }} | |
| {% endfor %} | |
| {% endfor %} | |
| </pre> | |
| """ | |
| nds = { | |
| u'outer1': ('mid1a', 'mid1b'), | |
| u'outer2': ('mid2a', ), | |
| } | |
| t = Template(ts) | |
| d = {'nds': nds} | |
| c = RequestContext(request, d) | |
| s = t.render(c) | |
| print "s=", s | |
| return HttpResponse(s) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment