django-renderit 1.2 documentation

Template Tags

renderit

Syntax

{% renderit [object] [arg] [arg] ... [with] [group=S] [prefix=S] [concat=S] [context=True|False] [site=True|False] [as] [varname] %}

Examples

Simplest Form:

{% renderit request.user %}

Multiple Arguments:

{% renderit request.user auth custom %}

With Prefix

{% renderit request.user auth custom with prefix=header %}

Change concatination string to be __ (double under score)

{% renderit request.user auth custom with prefix=header concat="__" %}

arguments

object

Only required argument, can be any python object.

args

Anything specified after [object] and before [with] will be treated as extra concatination strings. These can also be context variables.

Note

If an object is resolved and contains a space, the argument will be slugified, using django.template.defaultfilters.slugify

with

Required only if [group], [prefix] or [concat] is used.

group

This value is used to better structure the template location. A folder with the supplied value will be preprened to template path.

Example

{% renderit auth.user with group='users' %}

Template path built:

'/renderit/users/auth_user.html'

prefix

Prefixes the template with supplied value.

Example

{% renderit auth.user with prefix='users' %}

Template path built:

'/renderit/users_auth_user.html'

concat

Change the default concatination string when building templates, default is _ (underscore)

Example

{% renderit auth.user with concat="__" %}

Template path built:

'/renderit/auth__users.html'

Note

The default concatination string can be changed using CONCATINATION_STRING

context

If True (default) the template context will be passed into the template.

site

If True the site will be used to add additional possible templates on a per site basis

Example

{% renderit auth.user with site=True %}

as

Only required if a return variable is used.

varname

Store the rendered template into a context varaible.

Example

{% renderit auth.user as auth_var %}

{{ auth_var }}