summaryrefslogtreecommitdiff
path: root/model.py
diff options
context:
space:
mode:
Diffstat (limited to 'model.py')
-rw-r--r--model.py5
1 files changed, 3 insertions, 2 deletions
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))