djangosnippets.org: Latest snippets posted by sgbhttps://djangosnippets.org/users/sgb/2008-05-02T14:45:04.070503-05:00sgbSMTPConnection with Return-Path
2008-05-02T14:45:04.070503-05:00sgbhttps://djangosnippets.org/snippets/735/<p>Sometimes when sending email you want to specify a Return-Path different from the "From:" address on the email. The Return-Path is used for bounced email and is required for <a href="http://en.wikipedia.org/wiki/VERP">VERP</a>.</p>
<p>This class overrides SMTPConnection so that you can specify return_path.</p>
Freely redistributableProfiling middleware using cProfile
2008-04-27T14:24:22.093958-05:00sgbhttps://djangosnippets.org/snippets/727/<p>Similar to <a href="http://www.djangosnippets.org/snippets/186/">Profiling Middleware</a>, but uses cProfile instead of hotshot.</p>
<p>Append ?prof to the URL to see profiling output instead of page output.</p>
Freely redistributableTime ranges like 7-9 p.m.
2008-01-17T13:53:34.819848-06:00sgbhttps://djangosnippets.org/snippets/551/<p>Template filter to format a start and end time in to a range. Uses Django's <a href="http://www.djangoproject.com/documentation/templates/#now">"P" format</a> and assumes start and end time are on the same day or night before/morning after. </p>
<p><code>{{ start_time|time_range:end_time }}</code></p>
<p>Examples:</p>
<p>7-8 p.m.</p>
<p>8 p.m. - midnight</p>
<p>noon - 4 p.m.</p>
<p>9:45 a.m. - 5:15 …</p>
Freely redistributable