swissvotes.fields.dataset

Classes

SwissvoteDatasetField

An upload field expecting a Swissvotes dataset (XLSX).

Module Contents

class swissvotes.fields.dataset.SwissvoteDatasetField(label: str | None = None, validators: onegov.form.types.Validators[onegov.form.types.FormT, Self] | None = None, filters: collections.abc.Sequence[onegov.form.types.Filter] = (), description: str = '', id: str | None = None, default: collections.abc.Sequence[onegov.core.types.FileDict] = (), widget: onegov.form.types.Widget[Self] | None = None, render_kw: dict[str, Any] | None = None, name: str | None = None, _form: wtforms.form.BaseForm | None = None, _prefix: str = '', _translations: wtforms.meta._SupportsGettextAndNgettext | None = None, _meta: wtforms.meta.DefaultMeta | None = None, *, fieldset: str | None = None, depends_on: collections.abc.Sequence[Any] | None = None, pricing: onegov.form.types.PricingRules | None = None)[source]

Bases: onegov.form.fields.UploadField

An upload field expecting a Swissvotes dataset (XLSX).

data: list[onegov.swissvotes.models.SwissVote][source]
post_validate(form: wtforms.form.BaseForm, validation_stopped: bool) None[source]

Make sure the given XLSX is valid (all expected columns are present all cells contain reasonable values).

Converts the XLSX to a list of SwissVote objects, available as data.