A base view with a number of mixins are provided here, as well as a simple template view that provides an easy extra_context property.

class bambu_bootstrap.views.BootstrapView(**kwargs)

A class-based view to be rendered via a Bootstrap template, providing ways to setup <body> tag classes, formula for the <title> tag, the breadcrumb trail and a key indicating the selected main navigation item item.

get_base_context(request, **kwargs)

Sets up the base context for the templated view

class bambu_bootstrap.views.DirectTemplateView(**kwargs)

This is similar to Django’s old direct template generic view. It’s handiest when used for ‘static’ pages like homepages (ie: where dynamic data may come from context processors so a standard view isn’t needed). It supports context variables via the extra_context argument.

class bambu_bootstrap.views.FormMixin

A view mixin that provides a form for saving data.


alias of Form

get_form(request, **kwargs)

Instantiates the form


Redirects back to the currently-requested URL

save_form(request, form)

Saves the form data and returns the saved object

validate_form(request, form)

Checks that the form data is valid

class bambu_bootstrap.views.MessageMixin

A view mixin that provieds a simple way to implement django.contrib.messages. You can define messages for various labels (‘info’, ‘success’, ‘warning’, ‘error’) and send them via a simple function.

message(request, key)

Sends a message to a user

class bambu_bootstrap.views.ObjectMixin

A view mixin that makes it easier to work with single object views, where the title and breadcrumb trail might be influenced by a common factor