lck.django 0.8.5 documentation
The filters below are usable directly from pure Python code and obviously work as templatetags as well:
nbsp(obj) | Converts spaces to nbsp entities. |
numberify(obj[, default]) | Converts any type to int or returns a fallback number for falsy values. |
nullify(obj) | Converts any falsy value to None. |
slugify(text[, fallback]) | A version of the builtin django.template.defaultfilters which doesn’t let empty strings as outcomes. |
strike_empty(obj) | Converts any falsy value to u"---". |
thumbnail(image, size) | For a given image constructs a thumbnail using the rule specified in the size param. |
timediff(timestamp[, language]) | Returns a string representing a fuzzy time difference between now() and the input timestamp. |
title(text) | Like built-in |title filter but leaves existing caps alone, eg. |
transliterate(text, country_code[, text_lang]) | If the country with the specified code is using Cyrillic alphabet, |
To use these filters in your source code, simply import them from lck.django.filters. To use them as templatetags, add the lck.django.common app to INSTALLED_APPS within your settings.py and in the specific template use:
{%load LIB_NAME%}
where LIB_NAME is the templatetag library name for the specific filter (available in the filter description). For instance, for strike_empty or title it would be:
{%load strings%}
There are more filters whose implementation makes them useful only as templatetags. These include:
bbcode.bbcode(text) | Simply encode the BBCode within the text. |