Coverage for gws-app/gws/base/model/value.py: 0%
20 statements
« prev ^ index » next coverage.py v7.11.0, created at 2025-10-16 22:59 +0200
« prev ^ index » next coverage.py v7.11.0, created at 2025-10-16 22:59 +0200
1import gws
4class Config(gws.Config):
5 """Configuration for the model value."""
7 isDefault: bool = False
8 """If True, this value is the default for the model."""
9 forRead: bool = True
10 """The value is applied when reading an object."""
11 forCreate: bool = True
12 """The value is applied when creating a new object."""
13 forUpdate: bool = True
14 """The value is applied when updating an existing object."""
17class Object(gws.ModelValue):
18 def configure(self):
19 self.isDefault = self.cfg('isDefault', default=False)
21 self.ops = set()
23 if self.cfg('forRead'):
24 self.ops.add(gws.ModelOperation.read)
25 if self.cfg('forCreate'):
26 self.ops.add(gws.ModelOperation.create)
27 if self.cfg('forUpdate'):
28 self.ops.add(gws.ModelOperation.update)