Package pytils :: Package templatetags :: Module pytils_numeral
[hide private]
[frames] | no frames]

Module pytils_numeral

source code

pytils.numeral templatetags for Django web-framework

Functions [hide private]
  choose_plural(amount, variants)
Choose proper form for plural.
  rubles(amount, zero_for_kopeck=False)
Converts float value to in-words representation (for money)
  in_words(amount, gender=None)
In-words representation of amount.
  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.

Variables [hide private]
  __revision__ = '$Id: pytils_numeral.py 29 2006-10-21 08:28:27Z the....
  __id__ = '$Id: pytils_numeral.py 29 2006-10-21 08:28:27Z the....
  __url__ = '$URL: https://pythy.googlecode.com/svn/trunk/pytils...
  register = <django.template.Library object at 0xb7ab18ec>
Django template tag/filter registrator
  encoding = 'utf-8'
Current charset (sets in Django project's settings)
  debug = True
Debug mode (sets in Django project's settings)
  show_value = False
Show values on errors (sets in Django project's settings)
  default_value = 'unknown: %(error)s'
  default_uvalue = u'unknown: %(error)s'

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:"пример,примера,примеров" }}

rubles(amount, zero_for_kopeck=False)

source code 
Converts float value to in-words representation (for money)

in_words(amount, gender=None)

source code 

In-words representation of amount.

Parameter is a gender: 1=male, 2=female, 3=neuter

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

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 (1=male, 2=female, 3=neuter). Third is a variants of forms for object name.

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

Variables Details [hide private]

__revision__

None
Value:
'$Id: pytils_numeral.py 29 2006-10-21 08:28:27Z the.pythy $'           
      

__id__

None
Value:
'$Id: pytils_numeral.py 29 2006-10-21 08:28:27Z the.pythy $'           
      

__url__

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

register

Django template tag/filter registrator
Value:
<django.template.Library object at 0xb7ab18ec>                         
      

encoding

Current charset (sets in Django project's settings)
Value:
'utf-8'                                                                
      

debug

Debug mode (sets in Django project's settings)
Value:
True                                                                   
      

show_value

Show values on errors (sets in Django project's settings)
Value:
False                                                                  
      

default_value

None
Value:
'unknown: %(error)s'                                                   
      

default_uvalue

None
Value:
u'unknown: %(error)s'