diff options
Diffstat (limited to 'model.py')
-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)) |