Decorators

bambu_bootstrap.decorators.body_classes(func, *classes)

Decorates a view by adding a list of class names to the <body> tag. The prefered way to use this is to pass in a view that returns a TemplateResponse object, so that the decorator can modify the context variable dictionary, adding a body_classes list, or extending it if it already exists.

Parameters:
  • func – A callable that returns an HttpResponse or TemplateResponse object
  • classes – A list of classes to add to the <body> tag

Use this decorator in your URLconf like so:

from bambu_bootstrap.decorators import body_classes
from testproject.myapp import views
from django.conf.urls import patterns, url

urlpatterns = patterns('',
    url(r'^$', body_classes(views.home, 'homepage', 'index'))
)