gws.base.model.core

Base model.

Source code: gws.base.model.core

Module Contents

class gws.base.model.core.ClientOptions(*args, **kwargs)

Bases: gws.Data

Client options for a model

keepFormOpen: bool = False

Keep the edit form open after save

class gws.base.model.core.Config(*args, **kwargs)

Bases: gws.ConfigWithAccess

Model configuration

clientOptions: ClientOptions | None

Client options for a model. (added in 8.1).

excludeColumns: list[str] | None

Exclude columns names from autoload.

fields: list[gws.ext.config.modelField] | None

Model fields.

isEditable: bool = False

This model is editable.

loadingStrategy: gws.FeatureLoadingStrategy | None

Loading strategy for features.

sort: list[gws.SortOptions] | None

Default sorting.

tableViewColumns: list[TableViewColumn] | None

Fields to include in the table view.

templates: list[gws.ext.config.template] | None

Feature templates.

title: str = ''

Model title.

withAutoFields: bool = False

Autoload non-configured model fields from the source.

withTableView: bool = True

Enable table view for this model.

gws.base.model.core.DEFAULT_GEOMETRY_NAME = 'geometry'
gws.base.model.core.DEFAULT_UID_NAME = 'uid'
class gws.base.model.core.Object

Bases: gws.Model

Data Model.

configure()

Configuration hook.

configure_auto_fields()
configure_fields()
configure_geometry()
configure_model()

Model configuration protocol.

configure_provider()
configure_sort()
configure_sources()
configure_templates()
configure_uid()
feature_from_props(props, mc)
feature_to_props(feature, mc)
feature_to_view_props(feature, mc)
field(name)
find_features(search, mc)
get_features(uids, mc)
post_configure()

Post-configuration hook.

props(user)

Generate a Props struct for this object.

Parameters:

user – The user for which the props should be generated.

related_models()
table_view_columns(user)
validate_feature(feature, mc)
class gws.base.model.core.Props(*args, **kwargs)

Bases: gws.Props

Object properties.

canCreate: bool
canDelete: bool
canRead: bool
canWrite: bool
clientOptions: gws.ModelClientOptions
fields: list[gws.ext.props.modelField]
geometryCrs: str | None
geometryName: str | None
geometryType: gws.GeometryType | None
isEditable: bool
layerUid: str | None
loadingStrategy: gws.FeatureLoadingStrategy
supportsGeometrySearch: bool
supportsKeywordSearch: bool
tableViewColumns: list[TableViewColumn]
title: str
uid: str

Unique ID.

uidName: str | None
class gws.base.model.core.TableViewColumn(*args, **kwargs)

Bases: gws.Data

Table view column configuration.

name: str

Column name.

width: int | None

Column width in pixels. If not set, the column will be auto-sized.