The templates you make to use with Stoat are simply Django templates that take advantage of an extra variable.

The Page Variable

When Stoat renders a template it adds a page variable to the context. This variable has a few properties you’ll want to use.


The title of the page as defined in the admin interface.


A normal Django get_absolute_url method that will return the page’s URL.


This property contains all of the fields you’ve defined in STOAT_TEMPLATES, with their names lowercased and every non-letter/number replaced by an underscore.

For example: look at the following STOAT_TEMPLATES setting:

    'Default': ['default.html', [
        ['Heading',         'char'],
        ['Body',            'text'],
        ['Sidebar Heading', 'text'],
    'Product': ['pages/product.html', [
        ['Price',       'int'],
        ['Description', 'text'],
        ['Image',       'img'],
        ['Image 2',     'img'],

Here’s what pages/product.html might look like:

{% extends "base.html" %}

{% block content %}
    <h1>{{ page.title }}</h1>

    <img class="product-image" src="{{ page.fields.image }}" />
    <img class="product-image" src="{{ page.fields.image_2 }}" />

    <p class="price">Price: ${{ page.fields.price }}</p>

    {{ page.fields.description|linebreaks }}
{% endblock %}

You can use page.f as a shortcut for page.fields if you’d like to save on some typing.