Skip to content

Instantly share code, notes, and snippets.

@StarsHu
Last active November 8, 2017 08:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save StarsHu/300690b2a2f52bd1ed55a06b391aec42 to your computer and use it in GitHub Desktop.
Save StarsHu/300690b2a2f52bd1ed55a06b391aec42 to your computer and use it in GitHub Desktop.
django_template_example
{% for name in names %}
<img src="images/{{name}}.png" />
<a href="toggle/?name={{name}}&action=on">开</a><a href="toggle/?name={{name}}&action=off">关</a>'
{% endfor %}
def index(request):
context = {}
names = ['first','second','third','fourth']
return render(request,'index.html',{'names': names})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment