swissvotes.fields.metadata

Classes

SwissvoteMetadataField

An upload field expecting Swissvotes metadata (XLSX).

Module Contents

class swissvotes.fields.metadata.SwissvoteMetadataField(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 Swissvotes metadata (XLSX).

data: dict[decimal.Decimal, dict[str, Any]][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 metadata dictionaries objects, available as data.