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.
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.
Get language choices as code and text in two languages.
Returns: Available language codes as tuples ( code
,name
,local_name
) wherename
is in the currently active language, andlocal_name
is in the language of the item.Return type: Iterable[tuple[str,str,str]]
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:
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"
)
Get configuration variable value for the current shop.
Get global configuration variable value.
path
is the static source path, e.g. myapp/styles.csspackage
is the package name to get the version from.If not set, Shuup version is used. You can pass the name if any installed pacakge and use that version as a base.