Djangosnippets timeline

login_required decorator that doesn't redirect

A login_required decorator that wraps the login view instead of redirecting to it.

This prevents your site from leaking login information with HTTP status codes as explained here.

This is the way Django's admin is protected, the difference being that it checks for is_active and is_staff instead of is_authenticated ...

Current Page Middleware

This module provides a middleware that implements a mechanism to highlight a link pointing to the current URL.

Every link on the rendered page matching the current URL will be highlighted with a 'current_page' CSS class.

The name of the CSS class can be changed by setting CURRENT_PAGE_CLASS in the ...

Silently-failing include tag

This is the trick extended to Django templates.

Sometimes you need to insert some arbitrary code in the HTML of the production site for external service integration like uservoice, typekit, google analytics... You don't want to put this code into source control because some other sites using ...

Class-based coverage test runner

A coverage test runner that uses the class-based runner introduced with Django 1.2.

Put it in your python path and add to your

TEST_RUNNER = 'path_to.CoverageRunner'


Compatible with Django 1.2 and higher. You also need Ned Batchelder's ...