Page Contents

Previous topic

omeroweb.webgateway package

Next topic

omeroweb.webredirect package

This Page

omeroweb.webgateway.templatetags package

Submodules

omeroweb.webgateway.templatetags.common_filters module

omeroweb.webgateway.templatetags.common_filters.ago(value)

Formats a datetime.datetime object as time Ago. E.g. ‘3 days 2 hours 10 minutes’

omeroweb.webgateway.templatetags.common_filters.get_range(value)

Filter - returns a list containing range made from given value Usage (in template):

<ul>{% for i in 3|get_range %}
<li>{{ i }}. Do something</li>

{% endfor %}</ul>

Results with the HTML: <ul>

<li>0. Do something</li> <li>1. Do something</li> <li>2. Do something</li>

</ul>

Instead of 3 one may use the variable set in the views

omeroweb.webgateway.templatetags.common_filters.hash(value, key)
omeroweb.webgateway.templatetags.common_filters.jsonify(obj)

Simple template filter to encode a variable to JSON format

omeroweb.webgateway.templatetags.common_filters.lengthformat(value)

Filter - returns the converted value all values are in micrometers

omeroweb.webgateway.templatetags.common_filters.lengthunit(value)

Filter - returns th emost suitable length units all values are in micrometers

omeroweb.webgateway.templatetags.common_filters.random_if_minus_one(value)

Used for thumbnail versions

omeroweb.webgateway.templatetags.common_filters.random_if_none(value)
omeroweb.webgateway.templatetags.common_filters.shortening(value, arg)
omeroweb.webgateway.templatetags.common_filters.subtract(value, arg)

Subtracts the arg from the value

omeroweb.webgateway.templatetags.common_filters.timeformat(value)

Filter - returns the converted value with units all values are in seconds

omeroweb.webgateway.templatetags.common_filters.truncateafter(value, arg)

Truncates a string after a given number of chars Argument: Number of chars to truncate after

omeroweb.webgateway.templatetags.common_filters.truncatebefor(value, arg)

Truncates a string after a given number of chars Argument: Number of chars to truncate befor

omeroweb.webgateway.templatetags.common_tags module

class omeroweb.webgateway.templatetags.common_tags.PluralNode(quantity, single, plural)

Bases: django.template.base.Node

render(context)
class omeroweb.webgateway.templatetags.common_tags.SettingNode(option)

Bases: django.template.base.Node

render(context)
omeroweb.webgateway.templatetags.common_tags.do_plural(parser, token)

Usage: {% plural quantity name_singular name_plural %}

This simple version only works with template variable since we will use blocktrans for strings.

omeroweb.webgateway.templatetags.common_tags.setting(parser, token)

omeroweb.webgateway.templatetags.defaulttags module

omeroweb.webgateway.templatetags.defaulttags.static(path)

Joins the given path with the STATIC_URL setting.

Usage:

{% static path %}

Examples:

{% static "myapp/css/base.css" %}
{% static variable_with_path %}

omeroweb.webgateway.templatetags.wikitags module

omeroweb.webgateway.templatetags.wikitags.sharewikify(value)
omeroweb.webgateway.templatetags.wikitags.wikify(value)

Module contents