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

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.
  ru_strftime(date, format="%d.%m.%Y", inflected_day=False)
Russian strftime, formats date with given format.
  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.

Variables [hide private]
  __revision__ = '$Id: pytils_dt.py 29 2006-10-21 08:28:27Z the.pythy $'
  __id__ = '$Id: pytils_dt.py 29 2006-10-21 08:28:27Z the.pythy $'
  __url__ = '$URL: https://pythy.googlecode.com/svn/trunk/pytils...
  register = <django.template.Library object at 0xb7aad6ec>
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]

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__

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

__id__

None
Value:
'$Id: pytils_dt.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_dt.py $'                                                     
      

register

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

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'