skip to navigation
skip to content

djangohelpers 0.15

a collection of useful middleware, template tags, etc

Latest Version: 0.19


console scripts


A small script to output a new template tag to stdout, with human readable
phrases encouraged. Inspired by the nice prepositions in django-tagging's
template tags.

If djangohelpers is installed with ``, a `maketemplatetag` script
will be provided. Otherwise, it can also be invoked directly with
`python djangohelpers/`.

Run `python djangohelpers/` for usage information.



If enabled, it will intercept all requests that are not logged in, and
redirect them to the login view.

You can specify a list of anonymously-accessible URL paths (exempt from
this middleware) with an ANONYMOUS_PATHS list in your file.

These paths can be strings or regexes.

Strings will be treated as URL PREFIXES to match against.

Regexes will be matched against the URL directly.


If enabled, it will intercept requests with a querystring key `delete`.
GET requests will result in a confirmation form, and POST requests will
have their REQUEST_METHOD set to DELETE.

view decorators


@allow_http("GET", "DELETE")
def my_view(request, ...)

Requests with an allowed REQUEST_METHOD will be passed through untouched,
and all other requests will return HTTP 405 Method Not Allowed.


def my_view(request, ...)

If your view function returns a dict, it will be treated as a template context
and the template foo/bar.html will be rendered and returned. If your view
function returns anything besides a dict, its response will be passed through

An optional mimetype parameter is also supported:

@rendered_with('foo/bar.json', mimetype='application/json')
def my_view(request, ...)

template tags


A small collection of template tags and filters:

{% replace_value of 'b' with 7 in my_dict as new_dict %}

{{my_dict|qsify}} # converts a dict into a query string





Originally developed at the Columbia Center for New Media Teaching & Learning.  
File Type Py Version Uploaded on Size
djangohelpers-0.15.tar.gz (md5) Source 2014-01-10 6KB