djangosnippets.org: Latest snippets posted by udfalksohttps://djangosnippets.org/users/udfalkso/2010-02-20T12:45:24.768634-06:00udfalksosend_mail wrapper with DEBUG email trapping
2010-02-20T12:45:24.768634-06:00udfalksohttps://djangosnippets.org/snippets/1932/<p>By using this simple wrapper instead of Django's default send_mail function, you gain the peace of mind of knowing that when settings.DEBUG == True, all the emails will be sent to you instead of the original recipient. Handy for testing.<br />
</p>
Freely redistributableDebug Page Load Time Stats Middleware
2007-08-07T15:38:15.097383-05:00udfalksohttps://djangosnippets.org/snippets/358/<p>Use this to display a split of page execution time between python and the db in your base template when debugging. </p>
<p>I originally got the base of this code from another snippet, but I can't find it anymore and want to share with new folks because I find this handy. </p>
Freely redistributableIf in list template tag
2007-07-05T03:24:32.652039-05:00udfalksohttps://djangosnippets.org/snippets/302/<p>Given an item and a list, check if the item is in the list</p>
<pre><code>-----
item = 'a'
list = [1, 'b', 'a', 4]
-----
{% ifinlist item list %}
Yup, it's in the list
{% else %}
Nope, it's not in the list
{% endifinlist %}
</code></pre>
Freely redistributableProfiling Middlware
2007-04-17T17:17:10.682319-05:00udfalksohttps://djangosnippets.org/snippets/186/<p>Displays hotshot profiling for any view.
http://yoursite.com/yourview/?prof</p>
<p>Add the "prof" key to query string by appending ?prof (or &prof=)
and you'll see the profiling results in your browser.
It's set up to only be available in django's debug mode,
but you really shouldn't add this middleware to any production configuration. …</p>
Freely redistributable