Always have CSRF and Session cookies
Middleware that ensures clients always have CSRF tokens and session ids. Useful for some fat-client apps.
- middleware
- cookie
- session
- csrf
Middleware that ensures clients always have CSRF tokens and session ids. Useful for some fat-client apps.
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. The problem this snippet solves is that if your localsettings.py itself causes an ImportError somehow, that error will be silently swallowed and your intended localsettings will be ignored. Instead, we use `imp` to first check if the module exists, then unconditionally try to import it.
Middleware for implementing "hours of operation" for a website. In use (as configured here) on http://ianab.com/.
Instructions: Set your environment variables, install graphviz, and run. 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.
A zen study.
Makes new template tags "ifin" and "ifnotin".
andrew has posted 6 snippets.