djangosnippets.org: Latest snippets posted by chrjhttps://djangosnippets.org/users/chrj/2010-05-07T02:56:15.055269-05:00chrjMiddleware for using HttpOnly session cookie (including monkey patching for support for Python <2.6)
2010-05-07T02:56:15.055269-05:00chrjhttps://djangosnippets.org/snippets/2012/<p>A middleware to set the httponly flag on the session cookie. Including monkey patching for support for Python <2.6.</p>
Freely redistributableSerializing booleans correctly when doing dumpdata from a MySQL database using Django 0.96
2008-07-29T08:27:32.866839-05:00chrjhttps://djangosnippets.org/snippets/924/<p>Django 0.96 seems to have a bug when serializing from MySQL. BooleanFields are encoding as 0/1 instead of true/false. Hacking the python serializer seems to fix that. </p>
<p>The bug shows up as (fx. when using loaddata on a dump from MySQL in PostgreSQL):</p>
<pre><code>Problem installing fixture '/tmp/data.json': ERROR: column "is_staff" …</code></pre>
Freely redistributableWTForm (What The Form)
2007-05-03T13:52:06.707355-05:00chrjhttps://djangosnippets.org/snippets/214/<p>WTForm is an extension to the django newforms library allowing
the developer, in a very flexible way, to layout the form
fields using fieldsets and columns</p>
<p>WTForm was built with the well-documented <a href="http://developer.yahoo.com/yui/grids/">YUI Grid CSS</a> in
mind when rendering the columns and fields. This should make
it easy to implement …</p>
Freely redistributable