diff options
author | René 'Necoro' Neumann <necoro@necoro.net> | 2010-05-04 18:01:05 +0200 |
---|---|---|
committer | René 'Necoro' Neumann <necoro@necoro.net> | 2010-05-04 18:01:05 +0200 |
commit | db1ce7022eafa61be72b839dcde5b0a03450e95c (patch) | |
tree | 7620606c75e4dd8cb5e6130bb90a63c9d61c980f /model.py | |
parent | 7861d3979a91e739522150667171611987856e9b (diff) | |
download | kosten-db1ce7022eafa61be72b839dcde5b0a03450e95c.tar.gz kosten-db1ce7022eafa61be72b839dcde5b0a03450e95c.tar.bz2 kosten-db1ce7022eafa61be72b839dcde5b0a03450e95c.zip |
Correct numeric definition
Diffstat (limited to '')
-rw-r--r-- | model.py | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -20,6 +20,7 @@ elixir.metadata.bind.echo = True # ReqField = partial(Field, required = True) +ExpNum = T.Numeric(scale = 2, precision = 10) class Entity (elixir.Entity): using_options(abstract = True) @@ -47,7 +48,7 @@ class Expense (Entity): using_options(abstract = True) description = Field(T.String(50)) - expense = ReqField(T.Numeric(scale = 2)) + expense = ReqField(ExpNum) category = ManyToOne('Category', required = True, innerjoin = True) class SingleExpense (Expense): @@ -72,7 +73,7 @@ class ConstExpense (Expense): next = OneToOne('ConstExpense', inverse = 'prev') prev = ManyToOne('ConstExpense') - monthly = ColumnProperty(lambda c: sql.cast(c.expense / c.months, T.Numeric(scale = 2)), deferred = True) + monthly = ColumnProperty(lambda c: sql.cast(c.expense / c.months, ExpNum), deferred = True) start_year = ColumnProperty(lambda c: sql.extract('year', c.start)) start_month = ColumnProperty(lambda c: sql.extract('month', c.start)) |