URLs#

exception banjo.urls.JsonRequiresDict[source]#
banjo.urls.create_api_view(url, fn, method, args=None)[source]#

Creates an API view. An API view responds to GET requests with a HTML template– the response data for GET routes and a form for POST routes. For POST routes, the view processes the form.

banjo.urls.create_view(fn, method, args=None)[source]#

Creates a django view function. The view function checks that the HTTP method is correct, extracts the request’s params, passes them to fn, and returns the result. Args, if provided, should be a dict of {param_name: type}, where type is in [str, bool, int, float].

banjo.urls.route_get(url, args=None)[source]#

A decorator which registers a HTTP GET route in the Banjo app.

banjo.urls.route_post(url, args=None)[source]#

A decorator which registers a HTTP POST route in the Banjo app.

banjo.urls.validate_args(args)[source]#

Checks that args (the param type signature) is valid.