txcommon

Decorators

Template Tags

Common Tags

class CounterNode(initial)

A template node to count how many times it was called.

class ResolverNode

A small wrapper that adds a convenient resolve method.

resolve(var, context)

Resolves a variable out of context if it’s not in quotes

as_rest_title(value, border=None)

Return a value as a restructured text header.

border - Character to be used in the header bottom-border

counter(parser, token)

Return a number increasing its counting each time it’s called. An initial value can be passed to identify from which number it should start counting.

Syntax:

{% counter %}
{% counter 20 %}
form_as_table_rows(context, form, id=None)

Create a form using HTML table rows.

get_next(request)

Return the next path from the request.

Return a link to the homepage.

in_list(value, arg)

Check if a value is present in a list.

notice_type_user_filter(noticetype_list)

Filter a NoticeType list passed by parameter using the NOTICE_TYPES dictionary that says which notice types must be shown to the user.

It is necessary by now until the upstream project have a model change to be able to do this filtering from the database.

render_metacount(list, countable)

Return meta-style link rendered as superscript to count something.

For example, with list=[‘a’, ‘b’] and countable=’boxes’ return the HTML for “2 boxes”.

size_humanize(value)

Return a more human readable size number with the appropriate unit type.

strip_tags(value)

Return the value with HTML tags striped.

txrevision()

Return the revision of the Transifex repository in case it’s running on top of a checkout. If it’s not, return an empty string.

txversion()

Return the version of Transifex

txversion_full()

Return the full version of Transifex.

For versions that are not ‘final’ return the current version of Transifex plus the revision of the repository, in case it’s running on top of a checkout.

Search Filters

highlight_tag(parser, token)

{% highlight search_terms [ignore_case] [word_boundary] [class_name] [as name] %} ...text... {% endhighlight %}

hits_tag(parser, token)

{% hits search_terms [ignore_case] [word_boundary] [as name] %} ...text... {% endhits %}

searchexcerpt_tag(parser, token)

{% searchexcerpt search_terms [context_words] [ignore_case] [word_boundary] [as name] %} ...text... {% endsearchexcerpt %}

Views