swissvotes.layouts.default

Classes

DefaultLayout

Extends the base layout class with methods related to chameleon

Module Contents

class swissvotes.layouts.default.DefaultLayout(model: Any, request: onegov.swissvotes.request.SwissvotesRequest)[source]

Bases: onegov.core.layout.ChameleonLayout

Extends the base layout class with methods related to chameleon template rendering.

This class assumes the existance of two templates:

  • layout.pt -> Contains the page skeleton with headers, body and so on.

  • macros.pt -> Contains chameleon macros.

app: onegov.swissvotes.app.SwissvotesApp[source]
request: onegov.swissvotes.request.SwissvotesRequest[source]
day_long_format = 'skeleton:MMMMd'[source]
date_long_format = 'long'[source]
datetime_long_format = 'medium'[source]
title() str[source]
top_navigation() list[onegov.core.elements.Link][source]
breadcrumbs() list[onegov.core.elements.Link][source]
static_path() str[source]
sentry_init_path() str[source]
homepage_url() str[source]
votes_url() str[source]
login_url() str | None[source]
logout_url() str | None[source]
move_page_url_template() str[source]
locales() list[tuple[str, str, str, str]][source]
format_policy_areas(vote: onegov.swissvotes.models.SwissVote) markupsafe.Markup[source]
format_bfs_number(number: decimal.Decimal) str[source]

Hide the decimal places if there are none (simple votes).

format_number(number: numbers.Number | decimal.Decimal | float | None, decimal_places: int | None = None, padding: str = '') str[source]

Takes the given numer and formats it according to locale.

If the number is an integer, the default decimal places are 0, otherwise 2.

Overwrites parent class to use “.” instead of “,” for fr_CH locale as would be returned by babel.