swissvotes.models.file
Attributes
Classes
An attachment to a vote. |
|
An attachment to a translatable content page. |
|
A subset of files prefixed by the descriptor's name. |
|
A helper for localized files. |
|
Module Contents
- class swissvotes.models.file.SwissVoteFile[source]
Bases:
onegov.file.File
An attachment to a vote.
- class swissvotes.models.file.TranslatablePageFile[source]
Bases:
onegov.file.File
An attachment to a translatable content page.
- class swissvotes.models.file.FileSubCollection[source]
A subset of files prefixed by the descriptor’s name.
- class swissvotes.models.file.LocalizedFile(extension: str, label: str, static_views: dict[str, str])[source]
A helper for localized files.
Automatically choses the file according to the currently used locale. The files are internally stored as normal files using the filename to identify the wanted file.
Example:
- class MyModel(Base, AssociatedFiles):
pdf = LocalizedFile()
- __get_localized_name__(instance: HasFilesAndSessionManager[FileT], locale: str | None = None) str [source]
- __get_by_locale__(instance: HasFilesAndSessionManager[FileT] | None, locale: str | None = None) FileT | None [source]
- __get__(instance: HasFilesAndSessionManager[FileT] | None, owner: type[HasFilesAndSessionManager[FileT]]) FileT | None [source]
- __set_by_locale__(instance: HasFilesAndSessionManager[FileT], value: FileT, locale: str | None = None) None [source]
- class swissvotes.models.file.LocalizedFiles[source]
- classmethod localized_files() dict[str, LocalizedFile] [source]