swissvotes.models.file

Attributes

FileT

Classes

SwissVoteFile

An attachment to a vote.

TranslatablePageFile

An attachment to a translatable content page.

FileSubCollection

A subset of files prefixed by the descriptor's name.

LocalizedFile

A helper for localized files.

LocalizedFiles

Module Contents

swissvotes.models.file.FileT[source]
class swissvotes.models.file.SwissVoteFile[source]

Bases: onegov.file.File

An attachment to a vote.

__mapper_args__[source]
linked_swissvotes: sqlalchemy.orm.relationship[list[onegov.swissvotes.models.SwissVote]][source]
property locale: str[source]
property filename: str[source]
class swissvotes.models.file.TranslatablePageFile[source]

Bases: onegov.file.File

An attachment to a translatable content page.

__mapper_args__[source]
linked_swissvotes_page: sqlalchemy.orm.relationship[list[onegov.swissvotes.models.TranslatablePage]][source]
property locale: str[source]
property filename: str[source]
class swissvotes.models.file.FileSubCollection[source]

A subset of files prefixed by the descriptor’s name.

__set_name__(owner: type[HasFiles[FileT]], name: str) None[source]
__get__(instance: HasFiles[FileT] | None, owner: type[HasFiles[FileT]]) list[FileT][source]
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()

extension[source]
label[source]
static_views[source]
__set_name__(owner: type[HasFiles[FileT]], name: str) None[source]
__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]
__set__(instance: HasFilesAndSessionManager[FileT], value: FileT) None[source]
__delete_by_locale__(instance: HasFilesAndSessionManager[FileT], locale: str | None = None) None[source]
__delete__(instance: HasFilesAndSessionManager[FileT]) None[source]
class swissvotes.models.file.LocalizedFiles[source]
classmethod localized_files() dict[str, LocalizedFile][source]