Basic Usage

The first step to using Stoat is defining the templates you want to use for pages.

Defining Templates

You define the templates Stoat will use in your Django settings. Here’s a quick example to get you started:

    'Default': ['default.html', [
        ['Heading',       'char'],
        ['Body',          'ckeditor', { 'required': True }],
        ['Sidebar Body',  'text'],
        ['Sidebar Links', 'inline', { 'import': 'sidebar.admin.SidebarLinkInline' }],
    'Product': ['pages/product.html', [
        ['Price',       'int', { 'required': True }],
        ['Description', 'text'],
        ['Image',       'img'],
        ['Salesperson', 'fk', { 'app': 'auth', 'model': 'User' }],

The STOAT_TEMPLATES setting contains a dictionary mapping template names to template definitions.

Each template definition consists of:

  • A path
  • A list of fields
  • A dictionary of configuration options (optional)

The path is a normal Django template path, like you might use with render_to_response.

Each field is a list containing a name and a field type. The field name is how the field will be labels in the admin and referred to in your templates, and the field type is one of the supported types detailed in the next section.

The option dictionary maps options to values. Some options (such as required) can be used with any kind of field, while others are specific to a certain field type. See the Field Options section for more information on universal options, and the Field Types section for options specific to a single type.

There’s also a STOAT_DEFAULT_TEMPLATE setting that you need to set to the name of the template that should be considered the default.

Field Types

The following types of fields are available for use.

Note: Stoat actually stores all field data as Text data. The field types only change the form field type used (and validated) in the admin.


A basic Django BooleanField.


A basic Django CharField.


A CKEditor field. This requires that django-ckeditor be installed.


  • config: A string defining which of the CKEDITOR_CONFIGS should be used for this field.


A basic Django DecimalField.


A basic Django EmailField.


A basic Django FloatField.


A foreign key to a model. When using this field you must provide both of its options.


  • app: A string containing the name of the app the model is from.
  • model: A string containing the name of the model.


A FileBrowseField from django-filebrowser, with the 'Image' type.


An inline field allows you to create models that have a ForeignKey pointing at Stoat pages.

Check out the :doc:`Inlines </inlines>`_ documentation for more information.


A basic Django IntegerField.


A basic Django CharField, but rendered as with a <textarea> widget.


A basic Django URLField (with verify_exists set to False).

Field Options

The following options can be used for any field.


Ensures that this field is not left blank when editing the page in the admin interface.

Further Usage

Next you’ll want to check out the Admin documentation to learn how to use the admin interface for adding pages (it’s simple), and the Templating documentation to learn how to create Django templates for use with Stoat.

Project Versions

Table Of Contents

Previous topic


Next topic


This Page