djangosnippets.org: Latest snippets posted by davepeckhttps://djangosnippets.org/users/davepeck/2009-11-17T12:46:21.682897-06:00davepeckImageField for Google App Engine
2009-11-17T12:46:21.682897-06:00davepeckhttps://djangosnippets.org/snippets/1805/<p>This is a replacement for Django's built-in ImageField. It uses the Google AppEngine image APIs in order to validate. </p>
<p>Notes:</p>
<ol>
<li>Validation of the field counts against your App Engine transformations quota.</li>
<li>This code assumes you're only using the in-memory file upload handler. None of the other stock handlers work well …</li></ol>
Freely redistributableUsernameField (for clean error messages)
2009-08-06T18:31:36.551669-05:00davepeckhttps://djangosnippets.org/snippets/1673/<p>This is a username field that matches (and slightly tightens) the constraints on usernames in Django's <code>User</code> model. </p>
<p>Most people use RegexField, which is totally fine -- but it can't provide the fine-grained and user friendly messages that come from this field.</p>
Freely redistributableSQL Log To Console Middleware
2009-08-06T16:21:53.683787-05:00davepeckhttps://djangosnippets.org/snippets/1672/<p>When running the Django development server, this middleware causes all executed SQL queries to get printed out to the console.</p>
<p>This is based on <a href="http://www.djangosnippets.org/snippets/161/">Snippet 161</a>. The big difference is that 161 logs by adding stuff to your response text, which isn't very convenient IMO.</p>
Freely redistributable@url decorator improvements
2009-08-06T16:19:07.120806-05:00davepeckhttps://djangosnippets.org/snippets/1671/<p>A slight modification (and, I think, improvement) of the URL decorator found in <a href="http://www.djangosnippets.org/snippets/395/">snippet 395</a>.</p>
<p>What's different between this snippet and 395?</p>
<ol>
<li>We use <code>django.conf.urls.defaults.url()</code> when adding patterns</li>
<li>We support arbitrary arguments to the <code>url()</code> method (like <code>name="foo"</code>)</li>
<li>We <em>do not</em> support multiple url patterns (this didn't seem …</li></ol>
Freely redistributable