djangosnippets.org: Latest snippets tagged with 'with'http://djangosnippets.org/tags/with/2010-04-16T16:29:28.434195-05:00Partial templates, combine with and include
2010-04-16T16:29:28.434195-05:00koblashttp://djangosnippets.org/snippets/1989/<p>This snippet adds simple partial support to your templates. You can pass data to the partial, and use it as you would in a regular template. It is different from Django's {% include %}, because it allows you to pass a custom variable (context), instead of reusing the same context …</p>
Freely redistributableWithTag Tag
2008-06-30T06:42:56.084603-05:00versaehttp://djangosnippets.org/snippets/835/<p>Set a context variable with the returned value by any templatetag.
Useful for example in order to use url templatetag inside blocktrans:</p>
<p><code>{% withtag url my_app.views.my_view as my_view_url %}</code>
<code>{% blocktrans %}</code>
<code>Click <a href="{{ my_view_url }}">here</a></code>
<code>{% endblocktrans %}</code>
<code>{% endwithtab %}</code></p>
<p>Or with include templatetag:
<code>{% withtag include …</code></p>
Freely redistributable