gws.base.model.core

Base model.

Source code: gws.base.model.core

Module Contents

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

Bases: gws.ConfigWithAccess

Model configuration

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
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
uidName: str | None
class gws.base.model.core.TableViewColumn(*args, **kwargs)

Bases: gws.Data

Basic data object.

This object can be instantiated by passing one or or dict arguments and/or keyword args. All dicts keys and keywords become attributes of the object.

Accessing an undefined attribute returns None and no error is raised, unless the attribute name starts with an underscore.

name: str
width: int | None