summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--model.py14
1 files changed, 5 insertions, 9 deletions
diff --git a/model.py b/model.py
index 903797b..ece69ca 100644
--- a/model.py
+++ b/model.py
@@ -1,5 +1,6 @@
import elixir
from elixir import has_field, belongs_to, has_many, using_options, using_options_defaults
+from elixir import Field, ManyToOne
from sqlalchemy import types as T
from functools import partial
@@ -22,21 +23,16 @@ class Category (Entity):
return '<Category "%s">' % self.name
class Expense (Entity):
- using_options(inheritance='multi')
-
- has_field('description', T.String(50))
- has_req_field('expense', T.Numeric(scale = 2))
+ using_options(abstract = True)
- belongs_to('category', of_kind = 'Category', required = True)
+ description = Field(T.String(50))
+ expense = Field(T.Numeric(scale = 2), required = True)
+ category = ManyToOne('Category', required = True, innerjoin = True, lazy = False)
class SingleExpense (Expense):
- using_options(inheritance='multi')
-
has_req_field('date', T.Date)
class ConstExpense (Expense):
- using_options(inheritance='multi')
-
has_req_field('months', T.Integer)
has_req_field('start', T.Date)
has_req_field('end', T.Date)
class='deletions'>-481/+263 2020-01-11Set date only if not todayRené 'Necoro' Neumann1-1/+1 2020-01-11/add now remembers the date on reloadingRené 'Necoro' Neumann1-1/+16 2020-01-11Fix from upgrading flask-sqlalchemyRené 'Necoro' Neumann2-3/+6 2020-01-11Update Flask URLRené 'Necoro' Neumann1-1/+1 2020-01-11Increase copyrightRené 'Necoro' Neumann1-1/+1 2017-02-12Incorporate API changesRené 'Necoro' Neumann3-6/+6 2017-02-12Migrate flask.ext.foo to flask_fooRené 'Necoro' Neumann3-4/+4 2017-02-12Enable debugging for manage.shRené 'Necoro' Neumann1-1/+1 2017-02-12No need for flask-script anymore; flask provides this out of the boxRené 'Necoro' Neumann3-28/+17 2017-02-12No need for flask-sqlalchemy to track modifications and send eventsRené 'Necoro' Neumann1-0/+1 2017-02-12FixRené 'Necoro' Neumann1-1/+1 2016-07-08Constant -> KonstantRené 'Necoro' Neumann1-1/+1 2016-07-052to3 fixed too muchRené 'Necoro' Neumann1-1/+1 2016-07-052to3 conversionRené 'Necoro' Neumann12-42/+42 2016-07-05First batch of py3 changesRené 'Necoro' Neumann7-8/+7 2016-05-01Removed base 'Expense' class; introduce CategoryModel insteadRené 'Necoro' Neumann1-6/+7 2016-05-01Ignore .pyoRené 'Necoro' Neumann1-0/+1