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

Module pytils_dt

source code

pytils.dt templatetags for Django web-framework

Functions [hide private]
 
distance_of_time(from_time, accuracy=1)
Display distance of time from current time.
source code
 
ru_strftime(date, format='%d.%m.%Y', inflected_day=False)
Russian strftime, formats date with given format.
source code
 
ru_strftime_inflected(date, format='%d.%m.%Y', inflected_day=True)
Russian strftime with inflected day, formats date with given format (similar to ru_strftime), also inflects day in proper form.
source code
Variables [hide private]
  __revision__ = '$Id: pytils_dt.py 70 2007-02-19 03:42:32Z the....
  __id__ = '$Id: pytils_dt.py 70 2007-02-19 03:42:32Z the.pythy $'
  __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]

distance_of_time(from_time, accuracy=1)

source code 

Display distance of time from current time.

Parameter is an accuracy level (deafult is 1). Value must be numeral (i.e. time.time() result) or datetime.datetime (i.e. datetime.datetime.now() result).

Examples:
   {{ some_time|distance_of_time }}
   {{ some_dtime|distance_of_time:2 }}

ru_strftime(date, format='%d.%m.%Y', inflected_day=False)

source code 

Russian strftime, formats date with given format.

Value is a date (supports datetime.date and datetime.datetime), parameter is a format (string). For explainings about format, see documentation for original strftime: http://docs.python.org/lib/module-time.html

Examples:
   {{ some_date|ru_strftime:"%d %B %Y, %A" }}

ru_strftime_inflected(date, format='%d.%m.%Y', inflected_day=True)

source code 

Russian strftime with inflected day, formats date with given format (similar to ru_strftime), also inflects day in proper form.

Examples:
   {{ some_date|ru_strftime_inflected:"in %A (%d %B %Y)"

Variables Details [hide private]

__revision__

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

__url__

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