Package: towel-bootstrap
NoteYou have to addtowel_bootstraptoINSTALLED_APPS, preferably
beforedjango.contrib.adminbecause otherwise the bootstrapified
login, logout and password templates will not be picked up.Included goodiesBase templatestowel_bootstrap/base.html:Base template for everything. CSS is at the top, Javascript at the bottom.
Defines two Javascript arrays you might want to be aware of: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 eitherdocumentor some subset of the DOM
and the jQuery instance.towel_bootstrap/full.html:Template for full-width pages.towel_bootstrap/modal.html:Template for AJAX-loaded modals.towel_bootstrap/plain.html:Template covering a smaller width, most useful for login/logout pages and
such. Empties the main navigation.All base templates except fortowel_bootstrap/base.htmlextendbase.html. This means that if you provide your ownbase.htmlwhich only
overrides the bare minimum of regions, you can use all other templates right
away.The following blocks are available by default:title: Browser titlecss: CSS declaration.body: Everything inside<body/>except fortemplatesandjs.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<divclass="page-header"/>inside.content: Content.footer: The footer.templates: May be used for Javascript templates, meaning mainly for<scripttype="text/template"/>tags.js: All Javascript files and code.ModelView templatestowel_bootstrapcomes with a selection of templates most useful with
ModelView. Have a look at the files intowel_bootstrap/templates/modelview/.Towel templatestowel_bootstrapoverrides the styles of form items, form errors and
warnings, of ordering links in the list pages and of the pagination.Templates fordjango.contrib.authLog in, log out, password change and reset templates are included as well.Template tagsContains a template tag most useful for marking the current navigation entry.
Use as follows:{% load mark_current %}
{% mark_current request.path %}
    <li><a href="..."></a></li>
    <li><a href="..."></a></li>
    <li><a href="..."></a></li>
{% endmark_current %}Each navigation entry should occupy one line; adds aclass="active"where
the current URL begins with thehrefattribute value.Javascript helpersonReadyandonFormhave 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 matchingtextarea.autogrow.initForms([elem]): Runs all handlers inonForm. Defaults to handling
everything insidedocumentif no object is passed.modalLoad(url): Loads a bootstrap modal from a remote URL. This is
automatically activated for all elements matchinga[data-toggle=ajaxmodal].All AJAX requests are patched to work with Django’s CSRF protection.Third-party librariesjQuery.Harvest chosen.Bootstrap datepicker.Bootstrap itself is NOT included. The templates expect to find all of
bootstrap at{{ STATIC_URL }}bootstrap/.