python-domain-models
python-domain-models copied to clipboard
Fields custom getters and setters
The idea is to create functionality for specification of custom getters and setters for domain model fields.
class Profile(models.DomainModel):
id = fields.Int()
open_id = fields.Int()
@open_id.getter
def _get_oid(self):
return self.id >> 8
@open_id.setter
def _set_oid(self, value):
self.id = value << 8
Notes:
- If custom getter / setter is specified, it completely replaces field's getter / setter logic.
As we have contextual views now, is this task actual then? What do you think, @rmk135 ?