Package pytils :: Package templatetags :: Module pytils_numeral
[hide private]

Module pytils_numeral

source code

pytils.numeral templatetags for Django web-framework

Functions [hide private]
 
choose_plural(amount, variants)
Choose proper form for plural.
source code
 
rubles(amount, zero_for_kopeck=False)
Converts float value to in-words representation (for money)
source code
 
in_words(amount, gender=None)
In-words representation of amount.
source code
 
sum_string(amount, gender, items)
in_words and choose_plural in a one flask Makes in-words representation of value with choosing correct form of noun.
source code
Variables [hide private]
  __revision__ = '$Id: pytils_numeral.py 70 2007-02-19 03:42:32Z...
  __id__ = '$Id: pytils_numeral.py 70 2007-02-19 03:42:32Z the.p...
  __url__ = '$URL: https://pythy.googlecode.com/svn/trunk/pytils...
  register = template.Library()
Django template tag/filter registrator
  encoding = 'utf-8'
Current charset (sets in Django project's settings)
  debug = False
Debug mode (sets in Django project's settings)
  show_value = False
Show values on errors (sets in Django project's settings)
  default_value = ''
  default_uvalue = u''
Function Details [hide private]

choose_plural(amount, variants)

source code 

Choose proper form for plural.

Value is a amount, parameters are forms of noun. Forms are variants for 1, 2, 5 nouns. It may be tuple of elements, or string where variants separates each other by comma.

Examples:
   {{ some_int|choose_plural:"пример,примера,примеров" }}

in_words(amount, gender=None)

source code 

In-words representation of amount.

Parameter is a gender: MALE, FEMALE or NEUTER

Examples:
   {{ some_int|in_words }}
   {{ some_other_int|in_words:FEMALE }}

sum_string(amount, gender, items)

source code 

in_words and choose_plural in a one flask Makes in-words representation of value with choosing correct form of noun.

First parameter is an amount of objects. Second is a gender (MALE, FEMALE, NEUTER). Third is a variants of forms for object name.

Examples:
   {% sum_string some_int MALE "пример,примера,примеров" %}
   {% sum_string some_other_int FEMALE "задача,задачи,задач" %}

Variables Details [hide private]

__revision__

Value:
'$Id: pytils_numeral.py 70 2007-02-19 03:42:32Z the.pythy $'

__id__

Value:
'$Id: pytils_numeral.py 70 2007-02-19 03:42:32Z the.pythy $'

__url__

Value:
'$URL: https://pythy.googlecode.com/svn/trunk/pytils/pytils/templateta\
gs/pytils_numeral.py $'