From db1ce7022eafa61be72b839dcde5b0a03450e95c Mon Sep 17 00:00:00 2001 From: René 'Necoro' Neumann Date: Tue, 4 May 2010 18:01:05 +0200 Subject: Correct numeric definition --- model.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'model.py') diff --git a/model.py b/model.py index 0d2489a..867849f 100644 --- a/model.py +++ b/model.py @@ -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)) -- cgit v1.2.3-70-g09d2