form.models.submission

Module Contents

Classes

FormSubmission

Defines a submitted form in the database.

PendingFormSubmission

Defines a submitted form in the database.

CompleteFormSubmission

Defines a submitted form in the database.

FormFile

A general file (image, document, pdf, etc), referenced in the database.

class form.models.submission.FormSubmission[source]

Bases: onegov.core.orm.Base, onegov.core.orm.mixins.TimestampMixin, onegov.pay.Payable, onegov.file.AssociatedFiles, onegov.form.extensions.Extendable

Defines a submitted form in the database.

property payable_reference: str[source]

A string which identifies this payable in payment lists. Do not join any values here as it can lead to an explosion of executed queries!

By default we use the table name plus a hash derived from the primary key values of the table. This ensures that we do not accidentally leak secrets.

In practice, this reference should be customised for each payable.

property form_class: type[onegov.form.Form][source]

Parses the form definition and returns a form class.

property form_obj: onegov.form.Form[source]

Returns a form instance containing the submission data.

__tablename__ = 'submissions'[source]
id: Column[uuid.UUID][source]
name: Column[str | None][source]
title: Column[str | None][source]
email: Column[str | None][source]
definition: Column[str][source]
received: Column[datetime | None][source]
checksum: Column[str][source]
meta: Column[dict[str, Any]][source]
submitter_name: onegov.core.orm.mixins.dict_property[str | None][source]
submitter_address: onegov.core.orm.mixins.dict_property[str | None][source]
submitter_phone: onegov.core.orm.mixins.dict_property[str | None][source]
data: Column[dict[str, Any]][source]
state: Column[SubmissionState][source]
spots: Column[int][source]
claimed: Column[int | None][source]
registration_window_id: Column[uuid.UUID | None][source]
payment_method: Column[PaymentMethod][source]
minimum_price_total: onegov.core.orm.mixins.dict_property[float | None][source]
extensions: onegov.core.orm.mixins.dict_property[list[str]][source]
__mapper_args__[source]
__table_args__ = ()[source]
get_email_field_data(form: Form | None = None) str | None[source]
definition_observer(definition: str) None[source]
state_observer(state: onegov.form.types.SubmissionState) None[source]
process_payment(price: Price | None, provider: PaymentProvider[Any] | None = None, token: str | None = None) Payment | PaymentError | bool | None[source]

Takes a request, optionally with the provider and the token by the provider that can be used to charge the credit card and creates a payment record if necessary.

Returns True or a payment object if the payment was processed successfully. That is, if there is a payment or if there is no payment required the method returns truthy.

claim(spots: int | None = None) bool[source]

Claimes the given number of spots (defaults to the requested number of spots).

Return bool:

Whether or not claiming spots is possible

disclaim(spots: int | None = None) None[source]

Disclaims the given number of spots (defaults to all spots that were claimed so far).

class form.models.submission.PendingFormSubmission[source]

Bases: FormSubmission

Defines a submitted form in the database.

__mapper_args__[source]
class form.models.submission.CompleteFormSubmission[source]

Bases: FormSubmission

Defines a submitted form in the database.

__mapper_args__[source]
class form.models.submission.FormFile[source]

Bases: onegov.file.File

A general file (image, document, pdf, etc), referenced in the database.

Thanks to the use of Depot files can be seemingly stored in the database (with transaction guarantees), without actually storing it in the database.

property access: str[source]
__mapper_args__[source]