mirror of
https://github.com/django/django.git
synced 2025-10-24 06:06:09 +00:00
- The include tag now has a 'with' option to include to provide extra context
vairables to the included template.
- The include tag now has an 'only' option to exclude the current context
when rendering the included template.
- The with tag now accepts multiple variable assignments.
- The with, include and blocktrans tags now use a new keyword argument format
for variable assignments (e.g. `{% with foo=1 bar=2 %}`).
git-svn-id: http://code.djangoproject.com/svn/django/trunk@14922 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
@@ -371,12 +371,11 @@ using the :ttag:`include` tag to reuse it in other templates::
|
||||
{% endfor %}
|
||||
|
||||
If the form object passed to a template has a different name within the
|
||||
context, you can alias it using the :ttag:`with` tag::
|
||||
context, you can alias it using the ``with`` argument of the :ttag:`include`
|
||||
tag::
|
||||
|
||||
<form action="/comments/add/" method="post">
|
||||
{% with comment_form as form %}
|
||||
{% include "form_snippet.html" %}
|
||||
{% endwith %}
|
||||
{% include "form_snippet.html" with form=comment_form %}
|
||||
<p><input type="submit" value="Submit comment" /></p>
|
||||
</form>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user