djangosnippets.org: Latest snippets posted by pryanksterhttps://djangosnippets.org/users/pryankster/2007-04-06T15:23:29.497987-05:00pryanksterMaking templatetags global to all templates
2007-04-06T15:23:29.497987-05:00pryanksterhttps://djangosnippets.org/snippets/160/<p>I found myself putting <code>{%load ... %}</code> in every template that I was writing, so DRY .. I created an app called 'globaltags' and in its <code>__init__.py</code>, I just pre-load the tags that I use frequently.</p>
<p>The <a href="http://www.djangosnippets.org/snippets/130/">pyif</a> and <a href="http://www.djangosnippets.org/snippets/9/">expr</a> tags are excellent tags, and I highly recommend them …</p>
Freely redistributableTemplate tag to dump database query info
2007-04-06T15:19:55.779363-05:00pryanksterhttps://djangosnippets.org/snippets/159/<p>This snippet introduces two tags: <code>{%dbinfo%}</code> and <code>{%dbquerylist%}</code>. The <code>{%dbinfo%}</code> tag returns a string with the # of database queries and aggregate DB time. The <code>{%dbquerylist%}</code> tag expands to a set of &lt;LI&gt; elements containing the actual SQL queries executed. If <code>settings.TEMPLATE_DEBUG</code> is False, both tags return empty strings.</p>
Freely redistributable