Template names and directory structure

As introduced in the previous chapter, the “form_layouts” template tag library lets you customize several levels of form rendering. The template tag library searches for templates in a particular directory structure.

The default structure provided by django-formrenderingtools looks like this:

___+ templates => a template directory, included in settings.TEMPLATE_DIRS
   |___+ form_layouts => a directory for the form_layouts material
       |
       |___+ default => the default layout
           |
           |___+ field => templates for fields
               |
               |____ default.html => default template
           |
           |___+ field_errors
               |
               |____ default.html
           |
           |___+ field_list
               |
               |____ default.html
           |
           |___+ form
               |
               |____ default.html
           |
           |___+ form_errors
               |
               |____ default.html
           |
           |___+ help_text
               |
               |____ default.html
           |
           |___+ label
               |
               |____ default.html

How to use other locations?

Several parameters allow you to change the locations where template selection occurs:

  • settings.FORMRENDERINGTOOLS_TEMPLATE_DIR. A prefix for all templates used by the django-formrenderingtools application.
  • the “layout” parameter of the tags in the “form_layouts” template tag library.
  • the “template” parameter of the tags in the “form_layouts” template tag library.

Table Of Contents

Previous topic

Settings

Next topic

Cascading style sheets

This Page