ets-labs / python-domain-models

Domain models framework for Python projects
BSD 3-Clause "New" or "Revised" License
22 stars 4 forks source link

Fields custom getters and setters #26

Open rmk135 opened 8 years ago

rmk135 commented 8 years ago

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:

boonya commented 7 years ago

As we have contextual views now, is this task actual then? What do you think, @rmk135 ?