gws.plugin.model_field¶
Model field types.
Each subpackage implements one field type for models (gws.ext.object.modelField).
A field maps one attribute of a feature to a column (or a relationship) in the
data source, converts values between the database, Python and the client, and
creates a default widget when none is configured.
Scalar fields, based on gws.base.model.scalar_field:
bool: boolean values,togglewidget.date: dates, transferred as ISO strings,datewidget.datetime: date and time values, transferred as ISO strings,inputwidget.float: floating-point numbers,floatwidget.integer: integer numbers,integerwidget.text: strings, with optional keyword search,inputwidget.time: time values, transferred as ISO strings,inputwidget.geometry: geometries, used for spatial searches,geometrywidget.
Other fields, based on gws.base.model.field:
file: files stored in a database column, with download and preview URLs.
Related fields, based on gws.base.model.related_field, link features of
database models:
related_feature: M:1, the value is the parent feature.related_feature_list: 1:M, the value is the list of child features.related_multi_feature_list: 1:M with several child models.related_linked_feature_list: M:N via a link table.
Example:
models+ {
type "postgres"
tableName "edit.poi"
fields+ { name "id" type "integer" isPrimaryKey true }
fields+ { name "name" type "text" textSearch { type "any" } }
fields+ { name "geom" type "geometry" }
fields+ {
name "category"
type "relatedFeature"
fromColumn "category_id"
toModel "model_category"
widget.type "featureSelect"
}
}
Source code: gws.plugin.model_field
Subpackages¶
gws.plugin.model_field.boolgws.plugin.model_field.dategws.plugin.model_field.datetimegws.plugin.model_field.filegws.plugin.model_field.floatgws.plugin.model_field.geometrygws.plugin.model_field.integergws.plugin.model_field.related_featuregws.plugin.model_field.related_feature_listgws.plugin.model_field.related_linked_feature_listgws.plugin.model_field.related_multi_feature_listgws.plugin.model_field.textgws.plugin.model_field.time