Coverage for gws-app/gws/plugin/model_value/current_timestamp/__init__.py: 0%
10 statements
« prev ^ index » next coverage.py v7.16.2, created at 2026-10-05 13:35 +0200
« prev ^ index » next coverage.py v7.16.2, created at 2026-10-05 13:35 +0200
1"""Current timestamp value.
3Computes the current date and time (``gws.lib.datetimex.now``). Typically used
4to record when a feature was created or changed, or as a bound of a date range
5validator.
7Example::
9 fields+ {
10 name "updated_at"
11 type "datetime"
12 values+ { type "currentTimestamp" forRead false }
13 }
14"""
16import gws
17import gws.base.model.value
18import gws.lib.datetimex
21@gws.ext.config.modelValue('currentTimestamp')
22class Config(gws.base.model.value.Config):
23 """Value set to the current date and time."""
25 pass
28@gws.ext.object.modelValue('currentTimestamp')
29class Object(gws.base.model.value.Object):
30 """Current timestamp value object."""
32 def compute(self, field, feature, mc):
33 return gws.lib.datetimex.now()