shuup.core.templatetags package

Submodules

shuup.core.templatetags.prices module

Template tags for displaying prices correctly.

Prefer these filters for rendering prices of products and basket lines or total price of basket, since the will take price display options of current template context into account (see PriceDisplayOptions). Especially, they convert prices to correct taxness.

There is also a global context function show_prices which can be used to render certain price container elements conditionally.

shuup.core.templatetags.prices.show_prices(context)[source]

Return true if price display options has show prices enabled.

shuup.core.templatetags.shuup_common module

Common helpers for Shuup templates.

Note

In addition to these, also the price rendering tags from shuup.core.templatetags.prices module are available.

shuup.core.templatetags.shuup_common.get_language_choices()[source]

Get language choices as code and text in two languages.

Returns:Available language codes as tuples (code, name, local_name) where name is in the currently active language, and local_name is in the language of the item.
Return type:Iterable[tuple[str,str,str]]
shuup.core.templatetags.shuup_common.money(amount, digits=None, widen=0)[source]

Format money amount according to the current locale settings.

Parameters:
  • amount (shuup.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 the default 2.
Returns:

Formatted string representing the given amount

Return type:

str

shuup.core.templatetags.shuup_common.percent(value, ndigits=0)[source]
shuup.core.templatetags.shuup_common.number(value)[source]
shuup.core.templatetags.shuup_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 the 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 a given timezone (e.g. "US/Hawaii")
shuup.core.templatetags.shuup_common.json(value)[source]
shuup.core.templatetags.shuup_common.safe_product_description(value)[source]
shuup.core.templatetags.shuup_common.safe_vendor_description(value)[source]
shuup.core.templatetags.shuup_common.get_shop_configuration(context, name, default=None)[source]

Get configuration variable value for the current shop.

shuup.core.templatetags.shuup_common.get_global_configuration(name, default=None)[source]

Get global configuration variable value.

shuup.core.templatetags.shuup_common.get_shuup_version()[source]
shuup.core.templatetags.shuup_common.shuup_static(path, package=None)[source]

path is the static source path, e.g. myapp/styles.css package is the package name to get the version from.

System Message: ERROR/3 (/home/docs/checkouts/readthedocs.org/user_builds/shuup/checkouts/latest/shuup/core/templatetags/shuup_common.py:docstring of shuup.core.templatetags.shuup_common.shuup_static, line 3)

Unexpected indentation.
If not set, Shuup version is used. You can pass the name if any installed pacakge and use that version as a base.

Module contents