djangosnippets.org: Latest snippets posted by dsblankhttp://djangosnippets.org/users/dsblank/2009-12-21T17:56:20.017930-06:00dsblankfast table flush without raw SQL
2009-12-21T17:56:20.017930-06:00dsblankhttp://djangosnippets.org/snippets/1840/<p>Perhaps you don't want to drop a table, but you also want to do something faster than Model.objects.all().delete() but without resorting to raw SQL. This function, clear_tables, will call the sql_flush operation on a list of tables.</p>
Freely redistributablea simple tag with context
2009-12-21T17:48:26.599986-06:00dsblankhttp://djangosnippets.org/snippets/1839/<p>simple_tag is nice, but it would be useful if it had a "as variable" clause at the end. This little bit of code factors out the reusable parts and makes a tag almost as simple as simple_tag. Now you can create tags like the following:</p>
<pre><code>{% some_function 1 2 as …</code></pre>
Freely redistributable