From 155abf125c0b40483d404bf7aa10b7800398ac66 Mon Sep 17 00:00:00 2001 From: Yves Date: Sun, 20 Jun 2010 19:55:35 +0200 Subject: add value_int value_float value_string columsn --- ebus/web/model.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'ebus/web') 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 "" % (self.id, self.sensor, self.value, self.timestamp) -- cgit v1.2.1