djangosnippets.org: Latest snippets posted by andrewhttp://djangosnippets.org/users/andrew/2015-07-14T17:35:53.401368-05:00andrewAlways have CSRF and Session cookies
2015-07-14T17:35:53.401368-05:00andrewhttp://djangosnippets.org/snippets/10512/<p>Middleware that ensures clients always have CSRF tokens and session ids. Useful for some fat-client apps.</p>
Freely redistributablebetter localsettings import
2015-07-11T11:33:20.330738-05:00andrewhttp://djangosnippets.org/snippets/10511/<p>Most people simply wrap "from localsettings import *" in a try/except ImportError block. That's what I've done for years, but recently came up with this better way.</p>
<p>The problem this snippet solves is that if your localsettings.py itself causes an ImportError somehow, that error will be silently swallowed and your …</p>
Freely redistributableHours of Operation Middleware
2009-03-10T17:00:14.932065-05:00andrewhttp://djangosnippets.org/snippets/1363/<p>Middleware for implementing "hours of operation" for a website. In use (as configured here) on http://ianab.com/.</p>
Freely redistributableModel dependency graph using graphviz (script)
2008-09-05T01:25:40.581532-05:00andrewhttp://djangosnippets.org/snippets/1024/<p>Instructions: Set your environment variables, install graphviz, and run.
</p>
<p>Finds all models in your installed apps and makes a handsome graph of your their dependencies based on foreignkey relationships. Django models have green outlines, yours have purple. The edge styling could be changed based on edge type.
</p>
Freely redistributablepass a list to object_list
2008-04-29T17:24:15.085678-05:00andrewhttp://djangosnippets.org/snippets/733/<p>A zen study.
</p>
Freely redistributable"If in" template tag
2008-04-24T12:25:02.177645-05:00andrewhttp://djangosnippets.org/snippets/721/<p>Makes new template tags "ifin" and "ifnotin".</p>
Freely redistributable