gis.forms.fields

Classes

CoordinatesField

Represents a single pair of coordinates with optional zoom and

CoordinatesFieldRenderer

Provides utility functions for all renderers.

Module Contents

class gis.forms.fields.CoordinatesField(label: str | None = None, validators: Validators[FormT, Self] | None = None, filters: Sequence[_Filter] = (), description: str = '', id: str | None = None, default: AnyCoordinates | Callable[[], AnyCoordinates] | None = None, widget: _Widget[Self] | None = None, render_kw: dict[str, Any] | None = None, name: str | None = None, _form: BaseForm | None = None, _prefix: str = '', _translations: _SupportsGettextAndNgettext | None = None, _meta: DefaultMeta | None = None, *, fieldset: str | None = None, depends_on: Sequence[Any] | None = None, pricing: PricingRules | None = None)[source]

Bases: wtforms.fields.StringField

Represents a single pair of coordinates with optional zoom and marker icon/color selection.

In the browser and during transit the point is stored as a base64 encoded json string on a simple input field. For example:

eydsYXQnOiA4LjMwNTc2ODY5MTczODc5LCAnbG.. (and so on)

=>

{'lon': 8.30576869173879, 'lat': 47.05183585, 'zoom': 10}

For verification: This points to the Seantis office in Lucerne.

For convenience, the coordinates are accessible with the onegov.gis.models.coordinates.Coordinates class when ‘data’ is used.

Note that this field doesn’t work with the InputRequired validator. Instead the DataRequired validator has to be chosen.

data: onegov.gis.models.coordinates.AnyCoordinates[source]
widget: _Widget[Self][source]
_value() str[source]
process_data(value: object) None[source]

Process the Python data applied to this field and store the result.

This will be called during form construction by the form’s kwargs or obj argument.

Parameters:

value – The python object containing the value to process.

populate_obj(obj: object, name: str) None[source]

Populates obj.<name> with the field’s data.

Note:

This is a destructive operation. If obj.<name> already exists, it will be overridden. Use with caution.

process_formdata(valuelist: list[onegov.form.types.RawFormValue]) None[source]

Process data received over the wire from a form.

This will be called during form construction with data supplied through the formdata argument.

Parameters:

valuelist – A list of strings to process.

class gis.forms.fields.CoordinatesFieldRenderer[source]

Bases: onegov.form.display.BaseRenderer

Provides utility functions for all renderers.

__call__(field: CoordinatesField) markupsafe.Markup[source]