swissvotes.layouts.default
Classes
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.
- 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.