shoop.core.templatetags package

Submodules

shoop.core.templatetags.shoop_common module

shoop.core.templatetags.shoop_common.money(amount, digits=None, widen=0)[source]

Format money amount according to current locale settings.

Parameters:
  • amount (shoop.utils.money.Money) – Money or Price object to format
  • digits (int|None) – Number of digits to use, by default use locale’s default
  • widen (int) – Number of extra digits to add; for formatting with additional precision, e.g. widen=3 will use 5 digits instead of 2
Returns:

Formatted string representing the given amount

Return type:

str

shoop.core.templatetags.shoop_common.percent(value, ndigits=0)[source]
shoop.core.templatetags.shoop_common.number(value)[source]
shoop.core.templatetags.shoop_common.datetime(value, kind='datetime', format='medium', tz=True)[source]

Format a datetime for human consumption.

The currently active locale’s formatting rules are used. The output of this function is probably not machine-parseable.

Parameters:
  • value (datetime.datetime) – datetime object to format
  • kind (str) – Format as ‘datetime’, ‘date’ or ‘time’
  • format (str) – Format specifier or one of ‘full’, ‘long’, ‘medium’ or ‘short’
  • tz (bool|str) –

    Convert to current or given timezone. Accepted values are:

    True (default)
    convert to currently active timezone (as reported by django.utils.timezone.get_current_timezone)
    False (or other false value like empty string)
    do no convert to any timezone (use UTC)
    Other values (as str)
    convert to given timezone (e.g. "US/Hawaii")
shoop.core.templatetags.shoop_common.json(value)[source]

Module contents