fietsboek.jinja2 module¶
Custom filters for Jinja2.
- fietsboek.jinja2.filter_format_datetime(ctx, value)¶
Format a datetime according to the locale.
- fietsboek.jinja2.filter_format_decimal(ctx, value)¶
Format a decimal number according to the locale.
This uses the right thousands grouping and the right decimal separator.
- fietsboek.jinja2.filter_local_datetime(ctx, value)¶
Format a UTC datetime to show in the user’s local timezone.
This is done by embedding the UTC timestamp in the page, such that we can do some client-side magic and replace it with the time in the user’s local timezone. As a fallback value, we do apply the locale’s standard formatting, in case JavaScript is disabled - however, that will not represent the time in the user’s timezone, but in UTC.
- fietsboek.jinja2.global_embed_tile_layers(request)¶
Renders the available tile servers for the current user, as a JSON object.
The returned value is wrapped as a
Markup
so that it won’t get escaped by jinja.
- fietsboek.jinja2.global_list_languages(request)¶
Returns a list of available languages.
The first element of each tuple is the (technical) locale name, the second element is the display name.