djangosnippets.org: Latest snippets posted by gonzhttps://djangosnippets.org/users/gonz/2010-04-01T13:02:49.744453-05:00gonzCustom db backend for statement_timeout support (postgresql_psycopg2)
2010-04-01T13:02:49.744453-05:00gonzhttps://djangosnippets.org/snippets/1973/<p>Put this in a base.py file.</p>
<p>And config this settings:</p>
<p>DATABASE_ENGINE = 'path.to.module.with.base.file'
DATABASE_STATEMENT_TIMEOUT = 60000 # milliseconds</p>
<p>(Idea from: http://www.mailinglistarchive.com/html/django-developers@googlegroups.com/2009-02/msg00024.html)</p>
Freely redistributableForm field sets
2010-01-21T09:47:44.565908-06:00gonzhttps://djangosnippets.org/snippets/1878/<p>Create form atribute(s) for grouping (bound) fields.</p>
Freely redistributableTemplate tags/filter for working with query strings
2008-01-18T13:13:44.470194-06:00gonzhttps://djangosnippets.org/snippets/553/<p>Some template tags/filter for working with query strings in templates.</p>
<p>Examples:</p>
<pre><code>{% load qstring %}
{% qstring %} # Prints current request's query string
{% qstring as current_qstring %} # Same but goes to context
{{ current_qstring|qstring_del:"key1" }} # Deletes all key1 values
{{ current_qstring|qstring_del:"key1&key2" }} # Deletes all key1 …</code></pre>
Freely redistributableURL redirects middleware
2007-12-14T09:11:40.414491-06:00gonzhttps://djangosnippets.org/snippets/510/<p>Sometimes you need to make redirects that involve domains, you can't define those on the site urls, this middleware lets you define multiple redirects on your site settings.</p>
<p>Note: <em>You also can use the web server to do this, but I have found this middleware a useful tool to quickly …</em></p>
Freely redistributable