langacore.kit.django 0.3.3 documentation

This Page

langacore.kit.django.filters

A set of common independent filters usable directly in Python code.

Functions

nullify(obj)

Converts any falsy value to None.

Template tag available in common app’s converters library.

numberify(obj, default=0)

Converts any type to int or returns a fallback number for falsy values. Except for falsy values, throws traditional ValueError if the input is uncovertable to int.

Template tag available in common app’s converters library.

Parameters:
  • obj – the object to convert
  • default – a fallback int for falsy objects
slugify(text, fallback=u'untitled-0')

A version of the builtin django.template.defaultfilters which doesn’t let empty strings as outcomes.

Template tag available in common app’s strings library.

Parameters:
  • text – the text to slugify
  • fallback – the text to return in case the builtin slugify returns an empty value
strike_empty(obj)

Converts any falsy value to u"---".

Template tag available in common app’s strings library.

title(text)

Like built-in |title filter but leaves existing caps alone, eg. 'I work for the FBI' -> 'I Work For The FBI'.

Template tag available in common app’s strings library.

transliterate(text, country_code, text_lang=u'')

If the country with the specified code is using Cyrillic alphabet, transliterates Latin strings using langacore.kit.i18n.translit.

Template tag available in common app’s strings library.