template.loaders.filesystem.Loader

class filesystem.Loader Loads templates from the filesystem, according to DIRS. This loader is enabled by default. However it won’t find any templates until you set DIRS to a non-empty list: TEMPLATES = [{ 'BACKEND': 'django.template.backends.django.DjangoTemplates', 'DIRS': [os.path.join(BASE_DIR, 'templates')], }] django.template.loaders.app_directories.Loader

template.loaders.locmem.Loader

class locmem.Loader Loads templates from a Python dictionary. This is useful for testing. This loader takes a dictionary of templates as its first argument: TEMPLATES = [{ 'BACKEND': 'django.template.backends.django.DjangoTemplates', 'OPTIONS': { 'loaders': [ ('django.template.loaders.locmem.Loader', { 'index.html': 'content here', }), ], }, }] This loader is disabled by default. Django uses the template loaders in order ac

template.RequestContext

class RequestContext(request, dict_=None, processors=None) [source] Django comes with a special Context class, django.template.RequestContext, that acts slightly differently from the normal django.template.Context. The first difference is that it takes an HttpRequest as its first argument. For example: c = RequestContext(request, { 'foo': 'bar', }) The second difference is that it automatically populates the context with a few variables, according to the engine’s context_processors conf

template.response.SimpleTemplateResponse

class SimpleTemplateResponse [source]

template.response.SimpleTemplateResponse.add_post_render_callback()

SimpleTemplateResponse.add_post_render_callback() [source] Add a callback that will be invoked after rendering has taken place. This hook can be used to defer certain processing operations (such as caching) until after rendering has occurred. If the SimpleTemplateResponse has already been rendered, the callback will be invoked immediately. When called, callbacks will be passed a single argument – the rendered SimpleTemplateResponse instance. If the callback returns a value that is not None,

template.response.SimpleTemplateResponse.context_data

SimpleTemplateResponse.context_data The context data to be used when rendering the template. It must be a dict. Example: {'foo': 123}

template.response.SimpleTemplateResponse.is_rendered

SimpleTemplateResponse.is_rendered A boolean indicating whether the response content has been rendered.

template.response.SimpleTemplateResponse.render()

SimpleTemplateResponse.render() [source] Sets response.content to the result obtained by SimpleTemplateResponse.rendered_content, runs all post-rendering callbacks, and returns the resulting response object. render() will only have an effect the first time it is called. On subsequent calls, it will return the result obtained from the first call.

template.response.SimpleTemplateResponse.rendered_content

SimpleTemplateResponse.rendered_content The current rendered value of the response content, using the current template and context data.

template.response.SimpleTemplateResponse.resolve_context()

SimpleTemplateResponse.resolve_context(context) [source] Preprocesses context data that will be used for rendering a template. Accepts a dict of context data. By default, returns the same dict. Override this method in order to customize the context.