djfrontend/templatetags/djfrontend.py
def djfrontend_twbs_js(version=None, files=None):
    """
    Returns Twitter Bootstrap JavaScript file(s).
    all returns concatenated file; full file for TEMPLATE_DEBUG, minified otherwise.

    Other choice are:
        affix,
        alert,
        button,
        carousel,
        collapse,
        dropdown,
        modal,
        popover (adds tooltip if not included),
        scrollspy,
        tab,
        tooltip,
        transition.

    Individual files are not minified.
    """
    if version is None:
        if not getattr(settings, 'DJFRONTEND_TWBS_JS_VERSION', False):
            version = getattr(settings, 'DJFRONTEND_TWBS_VERSION', DJFRONTEND_TWBS_VERSION_DEFAULT)
        else:
            version = getattr(settings, 'DJFRONTEND_TWBS_JS_VERSION', DJFRONTEND_TWBS_VERSION_DEFAULT)

    if files:
        if files != 'all':
            files = files.split(' ')
    elif getattr(settings, 'DJFRONTEND_TWBS_JS_FILES', False) and settings.DJFRONTEND_TWBS_JS_FILES != 'all':
        files = settings.DJFRONTEND_TWBS_JS_FILES.split(' ')
    else:
        files = 'all'

    if files == 'all':
        return format_html(
            '<script src="//cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/{v}/js/bootstrap.min.js"></script>\n'
            '<script>window.jQuery.fn.scrollspy || document.write(\'<script src="{static}djfrontend/js/twbs/{v}/bootstrap.min.js"><\/script>\')</script>',
            v=version, static=_static_url)
    else:
        if 'popover' in files and 'tooltip' not in files:
            files.append('tooltip')
        for file in files:
            file = ['<script src="%sdjfrontend/js/twbs/%s/%s.js"></script>' %
                    (_static_url, version, file) for file in files]
        return mark_safe('\n'.join(file))
def djfrontend_twbs_js(version=None, files=None):
    """
    Returns Twitter Bootstrap JavaScript file(s).
    all returns concatenated file; full file for TEMPLATE_DEBUG, minified otherwise.

    Other choice are:
        affix,
        alert,
        button,
        carousel,
        collapse,
        dropdown,
        modal,
        popover (adds tooltip if not included),
        scrollspy,
        tab,
        tooltip,
        transition.

    Individual files are not minified.
    """
    if version is None:
        if not getattr(settings, 'DJFRONTEND_TWBS_JS_VERSION', False):
            version = getattr(settings, 'DJFRONTEND_TWBS_VERSION', DJFRONTEND_TWBS_VERSION_DEFAULT)
        else:
            version = getattr(settings, 'DJFRONTEND_TWBS_JS_VERSION', DJFRONTEND_TWBS_VERSION_DEFAULT)

    if files:
        if files != 'all':
            files = files.split(' ')
    elif getattr(settings, 'DJFRONTEND_TWBS_JS_FILES', False) and settings.DJFRONTEND_TWBS_JS_FILES != 'all':
        files = settings.DJFRONTEND_TWBS_JS_FILES.split(' ')
    else:
        files = 'all'

    if files == 'all':
        return format_html(
            '<script src="//cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/{v}/js/bootstrap.min.js"></script>\n'
            '<script>window.jQuery.fn.scrollspy || document.write(\'<script src="{static}djfrontend/js/twbs/{v}/bootstrap.min.js"><\/script>\')</script>',
            v=version, static=_static_url)
    else:
        if 'popover' in files and 'tooltip' not in files:
            files.append('tooltip')
        for file in files:
            file = ['<script src="%sdjfrontend/js/twbs/%s/%s.js"></script>' %
                    (_static_url, version, file) for file in files]
        return mark_safe('\n'.join(file))
Returns Twitter Bootstrap JavaScript file(s).
    all returns concatenated file; full file for TEMPLATE_DEBUG, minified otherwise.

    Other choice are:
        affix,
        alert,
        button,
        carousel,
        collapse,
        dropdown,
        modal,
        popover (adds tooltip if not included),
        scrollspy,
        tab,
        tooltip,
        transition.

    Individual files are not minified.