Template Tags

To use these, you’ll need to {% load widgy_tags %}.

widgy.templatetags.widgy_tags.render(node)[source]

Renders a node. Use this in your render.html templates to render any node that isn’t a root node. Under the hood, this template tag calls Content.render with the current context.

Example:

{% for child in self.get_children %}
  {% render child %}
{% endfor %}
widgy.templatetags.widgy_tags.scss_files(site)[source]
widgy.templatetags.widgy_tags.js_files(site)[source]

These template tags provide a way to extract the WidgySite.scss_files off of a site. This is required if you don’t have access to the site in the context, but do have a reference to it in your settings file. scss_files() and js_files() can also accept an import path to the site.

{% for js_file in 'WIDGY_MEZZANINE_SITE'|js_files %}
  <script src="{% static js_file %}"></script>
{% endfor %}
widgy.templatetags.widgy_tags.render_root(owner, field_name)[source]

The template entry point for rendering a tree. It delegates to WidgyField.render. The root_node_override template context variable can be used to override the root node that is rendered (for preview).

{% render_root owner_obj 'content' %}