landsgemeinde.forms.assembly

Classes

AssemblyForm

Base class for handling database models using named files with forms.

Module Contents

class landsgemeinde.forms.assembly.AssemblyForm(formdata: MultiDict[str, Any] | None = None, obj: object | None = None, prefix: str = '', data: dict[str, Any] | None = None, meta: dict[str, Any] | None = None, *, extra_filters: Mapping[str, Sequence[Any]] | None = None, **kwargs: Any)[source]

Bases: onegov.form.forms.NamedFileForm

Base class for handling database models using named files with forms.

Example:

class MyModel(AssociatedFiles):
    pdf = NamedFile()

class MyForm(NamedFileForm):
    pdf = UploadField('PDF')

@MyApp.form(model=MyCollection, form=MyForm, ...)
def add(self, request, form):

    if form.submitted(request):
        self.add(**form.get_useful_data())
        ...
    ...

@MyApp.form(model=MyModel, form=MyForm, ...)
def edit(self, request, form):

    if form.submitted(request):
        form.populate_obj(self)
        ...

    form.process(obj=self)
    ...
request: onegov.landsgemeinde.request.LandsgemeindeRequest[source]
date[source]
state[source]
extraordinary[source]
info_video[source]
video_url[source]
start_time[source]
memorial_pdf[source]
memorial_2_pdf[source]
memorial_supplement_pdf[source]
protocol_pdf[source]
audio_mp3[source]
audio_zip[source]
overview[source]
on_request() None[source]
get_useful_data() dict[str, Any][source]

Returns the form data in a dictionary, by default excluding data that should not be stored in the db backend.

validate_date(field: wtforms.fields.DateField) None[source]