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, preposition=False)
Russian strftime, formats date with given format.
source code
 
ru_strftime_inflected(date, format="%d.%m.%Y")
Russian strftime with inflected day, formats date with given format (similar to ru_strftime), also inflects day in proper form.
source code
 
ru_strftime_preposition(date, format="%d.%m.%Y")
Russian strftime with inflected day and correct preposition, formats date with given format (similar to ru_strftime), also inflects day in proper form and inserts correct preposition.
source code
Variables [hide private]
  __revision__ = "$Id: pytils_dt.py 102 2007-07-12 12:33:36Z the...
  __id__ = "$Id: pytils_dt.py 102 2007-07-12 12:33:36Z the.pythy $"
  __url__ = "$URL: https://pythy.googlecode.com/svn/tags/pytils/...
  register = template.Library()
Django template tag/filter registrator
  encoding = conf.settings.DEFAULT_CHARSET
Current charset (sets in Django project's settings)
  debug = conf.settings.DEBUG
Debug mode (sets in Django project's settings)
  show_value = getattr(conf.settings, 'PYTILS_SHOW_VALUES_ON_ERR...
Show values on errors (sets in Django project's settings)
  default_value = ""
  default_uvalue = u""

Imports: time, django.template, django.conf, dt, utils


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, preposition=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")

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)"

ru_strftime_preposition(date, format="%d.%m.%Y")

source code 

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

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

Variables Details [hide private]

__revision__

Value:
"$Id: pytils_dt.py 102 2007-07-12 12:33:36Z the.pythy $"

__url__

Value:
"$URL: https://pythy.googlecode.com/svn/tags/pytils/0_2_2/pytils/templ\
atetags/pytils_dt.py $"

show_value

Show values on errors (sets in Django project's settings)
Value:
getattr(conf.settings, 'PYTILS_SHOW_VALUES_ON_ERROR', False)