EngineMixin
This class provides a standardized interface for accessing a template engine backend within a form-related context. It implements a cached property to initialize the engine with specific application directories and provides a convenience method for retrieving templates by name.
Attributes
| Attribute | Type | Description |
|---|---|---|
| engine | django.template.backends.base.BaseEngine | The template engine instance initialized with default settings for Django forms, including application directories and a specific backend path. |
Methods
get_template()
@classmethod
def get_template(
template_name: string
) - > [Template](../../template/base/template.md?sid=django_template_base_template)
Retrieves a template object by its name using the configured template engine.
Parameters
| Name | Type | Description |
|---|---|---|
| template_name | string | The name or path of the template file to be loaded by the engine |
Returns
| Type | Description |
|---|---|
[Template](../../template/base/template.md?sid=django_template_base_template) | A template object that can be used for rendering content |
engine()
@classmethod
def engine() - > [BaseEngine](../../template/backends/base/baseengine.md?sid=django_template_backends_base_baseengine)
Initializes and caches the template backend engine with default configurations for application directories and paths.
Returns
| Type | Description |
|---|---|
[BaseEngine](../../template/backends/base/baseengine.md?sid=django_template_backends_base_baseengine) | The initialized template backend instance configured for the djangoforms application |