Skip to main content

Included goodies

Base templates

  • 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 either document or some subset of the DOM and the jQuery instance.

  • towel/modal.html:

    Template for AJAX-loaded modals.

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.

  • templates: May be used for Javascript templates, meaning mainly for <script type="text/template"/> tags.

  • js: All Javascript files and code.

ModelView templates

towel_foundation comes with a selection of templates most useful with ModelView. Have a look at the files in towel_foundation/templates/modelview/.

Towel templates

towel_foundation 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.

Template tags

Contains 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 a class="active" where the current URL begins with the href attribute value.

Javascript helpers

  • 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 foundation 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.

Third-party libraries

Release files for towel-foundation 0.8.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for towel-foundation 0.8.3
File Size Uploaded
towel-foundation-0.8.3.tar.gz 49.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for towel-foundation 0.8.3
File Interpreter ABI Platform
towel_foundation-0.8.3-py2-none-any.whl Python 2 none any Details

Total release size:119.8 kB

Release files / towel-foundation-0.8.3.tar.gz

Download URL towel-foundation-0.8.3.tar.gz
Size 49.9 kB
Tags Source
SHA-256 checksum
How to use checksums
b16c846db790579cd31bbe9af0d9dceda1f14b7424d92f584bbdeb0dde9dec2e
BLAKE2b-256 checksum
How to use checksums
6d020d177c022bc80b9ff1921a946cfed0939d971f73087ed6b04f373881502d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.2.0 requests-toolbelt/0.8.0 tqdm/4.25.0 CPython/2.7.15rc1

Release files / towel_foundation-0.8.3-py2-none-any.whl

Download URL towel_foundation-0.8.3-py2-none-any.whl
Size 69.9 kB
Tags Python 2
SHA-256 checksum
How to use checksums
0ef7a99057a349bd692536707d25f0ae60e6926a0cd4920813686c1c6aed7ae4
BLAKE2b-256 checksum
How to use checksums
2b15353afc35e1e40fd0ec38fcd7a0b7fb0b962516947bcffe38a3c15409bbf0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.2.0 requests-toolbelt/0.8.0 tqdm/4.25.0 CPython/2.7.15rc1

Release history Release notifications | RSS feed

0.30.0

2 release files

This release

0.8.3 This release

2 release files

0.8.2

2 release files

0.8.1

1 release file

0.8.0

2 release files

0.7.0

1 release file

0.6.0

1 release file

0.5.0

1 release file

0.4.2

1 release file

0.4.1

1 release file

0.4.0

1 release file

0.3.0

1 release file

0.2.0

1 release file

0.1.2

1 release file

0.1.1

1 release file

0.1.0

1 release file

0.0.1

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page