Skip to main content
Contents:

console scripts
===============

`maketemplatetag`
-----------------

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 `setup.py`, a `maketemplatetag` script
will be provided. Otherwise, it can also be invoked directly with
`python djangohelpers/console_scripts.py`.

Run `python djangohelpers/console_scripts.py` for usage information.


middleware
==========

djangohelpers.middleware.AuthRequirementMiddleware
--------------------------------------------------

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 settings.py 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.


djangohelpers.middleware.HttpDeleteMiddleware
---------------------------------------------

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
===============

djangohelpers.allow_http
------------------------

@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.


djangohelpers.rendered_with
---------------------------

@rendered_with('foo/bar.html')
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
untouched.

An optional mimetype parameter is also supported:

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


template tags
=============

djangohelpers.templatetags.helpful_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

{{sometextwithwhitespace|split}}

{{my_dict|getitem:'b'}}

{{value|lessthan:12}}

{{value|greaterthan:12}}

Originally developed at the Columbia Center for New Media Teaching & Learning.

Metadata

Release files for djangohelpers 0.19

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for djangohelpers 0.19
File Size Uploaded
djangohelpers-0.19.tar.gz 7.0 kB Details

Release files / djangohelpers-0.19.tar.gz

Download URL djangohelpers-0.19.tar.gz
Size 7.0 kB
Tags Source
SHA-256 checksum
How to use checksums
87aa3540a80b981f527c4789160c28f30256665726bfa6c25da480a1f3231210
BLAKE2b-256 checksum
How to use checksums
14aec3e0e6f3cdc457839b1a98a5c3ebb16d1f5a2f3ad06d4c9790b68c4a8514
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.19 This release

1 release file

0.18.2

1 release file

0.18.1

1 release file

0.18

1 release file

0.17

1 release file

0.16

1 release file

0.15

1 release file

0.14

1 release file

0.13

1 release file

0.12

1 release file

0.11

1 release file

0.10

1 release file

0.9

1 release file

0.8

1 release file

0.7

1 release file

0.6

1 release file

0.5

1 release file

0.4

1 release file

0.3.1

1 release file

0.3

1 release file

0.2

1 release file

0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page