Keeping you DRY since 2010
You have to add towel_bootstrap to INSTALLED_APPS, preferably before django.contrib.admin because otherwise the bootstrapified login, logout and password templates will not be picked up.
- onReady: A list of functions which will be run on $(document).ready(). Receive the jQuery instance as first and only argument.
- onForm: A list of functions which initialize forms. Might be called several times on the same set of elements. Receive two arguments, a jQuery object wrapping either document or some subset of the DOM and the jQuery instance.
Template for full-width pages.
Template for AJAX-loaded modals.
Template covering a smaller width, most useful for login/logout pages and such. Empties the main navigation.
All base templates except for towel_bootstrap/base.html extend base.html. This means that if you provide your own base.html which only overrides the bare minimum of regions, you can use all other templates right away.
The following blocks are available by default:
- title: Browser title
- css: CSS declaration.
- body: Everything inside <body/> except for templates and js.
- navigation: The content of the navbar.
- main: The main container, that is, everything except for the navigation and the footer.
- search: A search form embedded in the sidebar.
- sidebar: The sidebar itself.
- messages: A messages container above the page header and the content.
- page-header: The page header, most useful when there is a <div class="page-header"/> inside.
- content: Content.
- footer: The footer.
towel_bootstrap comes with a selection of templates most useful with ModelView. Have a look at the files in towel_bootstrap/templates/modelview/.
towel_bootstrap overrides the styles of form items, form errors and warnings, of ordering links in the list pages and of the pagination.
Templates for django.contrib.auth
Log in, log out, password change and reset templates are included as well.
- onReady and onForm have already been described above.
- $.fn.flash: Changes a set of elements to be partially translucent before fading them in to complete opacity again.
- $.fn.autogrow: When applied to a textarea, causes the textarea to automatically expand in height when new content is added so that no scrollbar appears. Is applied by default to all elements matching textarea.autogrow.
- initForms([elem]): Runs all handlers in onForm. Defaults to handling everything inside document if no object is passed.
- modalLoad(url): Loads a bootstrap modal from a remote URL. This is automatically activated for all elements matching a[data-toggle=ajaxmodal].
- All AJAX requests are patched to work with Django’s CSRF protection.