djangosnippets.org: Latest snippets tagged with 'variables'http://djangosnippets.org/tags/variables/2010-03-21T09:02:53.781214-05:00Template tag which gets specific GET variables from the current request
2010-03-21T09:02:53.781214-05:00aruseni.magikuhttp://djangosnippets.org/snippets/1965/<p>This template tag attempts to get specific GET variables from request.GET. If such variables exist, it shows them as a query string (with optional "include_ampersand" mode when it puts an "&" at the end if there is a result string, or a "?" if there's none: it is used when …</p>
Freely redistributableCreate variables within templates
2008-06-27T14:44:45.527480-05:00nkwentihttp://djangosnippets.org/snippets/829/<p>Here is a Django template tag that allows you to create complex variables specified in JSON format within a template.</p>
<p>It enables you to do stuff like:</p>
<pre><code>{% var as person %}
{
"firstName": "John",
"lastName": "Smith",
"address": {
"streetAddress": "21 2nd Street",
"city": "New York",
"state": "NY",
"postalCode": 10021 …</code></pre>
Freely redistributableRepeat blocks with new context / simple Jinja-like macro system
2007-07-26T19:14:21.350396-05:00miracle2khttp://djangosnippets.org/snippets/343/<p>A simple macro system that makes it possible to reuse previously defined
blocks, optionally with a custom context, similar to the macro
functionality in Jinja. <br />
</p>
<p>It requires some workarounds/hacks because we cannot reach
all the data from inside the django template system that we need, but it
seems to work …</p>
Freely redistributable