diff options
author | Yves <yvesf-git@xapek.org> | 2010-06-20 19:55:35 +0200 |
---|---|---|
committer | Yves <yvesf-git@xapek.org> | 2010-06-20 19:55:35 +0200 |
commit | 155abf125c0b40483d404bf7aa10b7800398ac66 (patch) | |
tree | 5b1db00eb29a45b0a24d648d68e8eab4186b83a1 | |
parent | 9bf7c799973fb7158797f92880cefb3c5939611c (diff) | |
download | ebus-alt-155abf125c0b40483d404bf7aa10b7800398ac66.tar.gz ebus-alt-155abf125c0b40483d404bf7aa10b7800398ac66.zip |
add value_int value_float value_string columsn
-rw-r--r-- | ebus/web/model.py | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/ebus/web/model.py b/ebus/web/model.py index e7744df..e9fc04c 100644 --- a/ebus/web/model.py +++ b/ebus/web/model.py @@ -21,7 +21,6 @@ class Sensor(ModelBase): - class Value(ModelBase): __tablename__ = 'value' @@ -29,12 +28,17 @@ class Value(ModelBase): timestamp = Column(DateTime) sensor_id = Column(Integer, ForeignKey("sensor.id")) sensor = relationship(Sensor, backref=backref('values', order_by=timestamp)) - value = Column(Float(precision=4)) - def __init__(self, sensor, value, timestamp=datetime.now()): - self.sensor = sensor - self.value = value + value_float = Column(Float(precision=4)) + value_int = Column(Integer) + value_string = Column(String) + + def __init__(self, sensor, value_float=None, value_int=None, value_string=None, timestamp=datetime.now()): self.timestamp = timestamp + self.sensor = sensor + self.value_float = value_float + self.value_int = value_int + self.value_string = value_string def __repr__(self): return "<Value('%s','%s','%s','%s'>" % (self.id, self.sensor, self.value, self.timestamp) |